• Resolved aleksdab

    (@aleksdab)


    Hi,

    could I set a different landing page for B2C and B2B customers? I would like to redirect users to different pages immediately after logging in.

    I will be very grateful for your support.

    Best regards,

    Ola

    ikona Zweryfikowane przez spo?eczno??
Viewing 1 replies (of 1 total)
  • Plugin Author WebWizards

    (@webwizardsdev)

    Hi Ola,

    To achieve a redirect login like that, you can add the following PHP code snippet to your site:

    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;
    }

    (the above redirects b2b users to site.com/page1, and b2c users to site.com/page2)

    This code can be added to functions.php of the child theme, or to any code snippets plugin.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.