Okay
  Public Ticket #3781628
redirect after login
Closed

Comments

  •  1
    Sander started the conversation

    How To Change the Redirection Page After Login?

  •  2,619
    WebWizards replied

    Hi there,

    You can specify a login redirection page using this code snippet:

    add_filter( 'woocommerce_login_redirect', 'custom_login_redirect', 1000000, 2 );
    function custom_login_redirect( $redirect, $user ) {
    
        $is_b2b = get_user_meta($user->ID, 'b2bking_b2buser', true);
    
        if ( $is_b2b === 'yes' ){
        	$redirect = '/page1'; // B2B page here
        } else {
        	$redirect = '/page2'; // B2C page here
        }
    
        return $redirect;
    }

    This sets a different page for b2b and b2c if you need. If not, you can set both to the same page.

     

    This code snippet can be added to functions.php or to any code snippets plugin.

    Kind regards,

    Stefan