Okay
  Public Ticket #3622639
How to Change Redirect to Homepage Instead of /shop After Sub-Account Login
Closed

Comments

  •  2
    Dario started the conversation

    Hello,

    Currently, after sub-account login from the main account, users are redirected to the /shop page. I would like to modify this so that users are instead redirected to the homepage.

    Could you provide guidance on how to implement this change?


    Best regards.

  •  2,619
    WebWizards replied

    Hello Dario,

    To make that redirect to the homepage, please add this PHP code snippet to your site:

    add_filter('b2bkingking_login_subaccount_link', function($url){    
        return get_home_url();
    }, 10, 1);

    This snippet can be added to functions.php, or by following our guide here: https://woocommerce-b2b-plugin.com/docs/how-to-add-a-snippet-php-or-js/


    Kind regards,

    Stefan

  •  2
    Dario replied

    Thanks for solving this.

    Kind regards.

  •  2
    Dario replied

    I would also like to ask for the code that redirects to the homepage when a SalesKing agent logs into a customer's account.

  •  2,619
    WebWizards replied

    Certainly, you can use the following code snippet for that:

    add_filter('salesking_shop_as_customer_link', function($url){    
        return get_home_url();
    }, 10, 1);
    

    It should redirect agents to the home page, after they click on 'shop as customer'.