Public Ticket #3515939

Redirect after vendor registration

Closed
Comments
45 Tickets 21
Andrea started the conversation 3 years ago on November 6, 2023 at 1:54pm

Hello! Is there a way to change the redirect URL after vendor registration?

I want to redirect user to a custom page if he registered as vendor.

2,762
KingsPlugins replied 3 years ago on November 6, 2023 at 8:43pm

Hi there!

I can send you a code snippet for this.

Are you using manual approval for vendors, or automatic approval?


I ask because I think different code would be needed.


Kind regards,

Stefan

2,762
KingsPlugins replied 3 years ago on November 8, 2023 at 3:12am

Great, you can use this code snippet then:

add_filter('marketking_no_approval_redirect_url', function($url){
    return 'https://yoursite.com/linkurl';
}, 10, 1);


You'd just need to change the URL to your own.


2,762
KingsPlugins replied 3 years ago on November 14, 2023 at 4:32am

Hi Andrea,

I was able to look into this now.

I noticed that registering an account lead to the home page. This is unusual, because normally MarketKing leads to the "/my-account/?redir=1" link. This indicated to me it might be a plugin or theme conflict.


I switched the theme to the Twenty twenty one theme and tested a registration. I then saw the normal link:

1650189714.png


Based on this, I believe there is some code in your theme that is forcing a Home page redirect, rather than our plugin's redirect (Which would also be why the redirect your custom page would not work).



I investigated the functions.php file further and I found the code causing the issue:

add_action('wp_logout','afield_redirect_after_logout');
function afield_redirect_after_logout(){
  wp_safe_redirect( home_url() );
  exit;
}

Here's what happens: WooCommerce normally logs in a user after registering. In order for MarketKing to show the "thank you for registering...please wait to be approved" message, we need to technically log out the user - which is where the above code interferes and redirects to the home page.


It would be needed to modify or remove that code.


Kind regards,

Stefan

Sign In