How To Change the Redirection Page After Login?
redirect after login
Closed
Comments
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