Okay
  Public Ticket #3674472
Existing Users Can Apply (beta) - not functioning.
Closed

Comments

  •  1
    Henry started the conversation

    Hi - I wish to offer B2C customers the option of upgrading their B2C account to a B2B account - I have enabled this in setup - how do I make it show on the login/register page?

  •  2,214
    WebWizards replied

    Hi Henry,

    I'd be glad to assist,


    Normally the way this feature works is that is just allows B2C users to go to some "Apply for B2B" page that you have created. I think on your site that is https://www.rathergoodart.co.uk/wholesale-registration-page/

    If you'd like, we can also just show this on the my account page for users, either by adding a link to the registration form, or displaying the form directly.

    For example, you can add the following PHP code snippet to your site:

    add_action('woocommerce_account_dashboard', function(){
        $user_id = get_current_user_id();
        $is_b2b = get_user_meta($user_id,'b2bking_b2buser', true);
        if ($is_b2b !== 'yes'){
            echo '<h4>Apply to become a B2B user: </h4>';
            echo do_shortcode('[b2bking_b2b_registration_only registration_role_id=101053]');
        }
    });
    

    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/


    It should result in a display such as the following one on the my account page:

    9331539785.png



    Kind regards,

    Stefan

  •  1
    Henry replied

    Hi Stefan - thanks for that - however when I attempt to upgrade an account, I get the message that 'this email is already in use' returned to me. Is there a way of upgrading the existing customer account please?

  •  2,214
    WebWizards replied

    Hi Henry,

    I tested that code now on my local site, with an existing B2C user, trying to apply from the my account page. However for some reason I do not seem to get that error, this is what I see:

    https://www.loom.com/share/6402f975d9bf484190cc47c03d9b92ee?sid=8fbccb8f-117f-4a6b-8dcf-f695d295aaa9


    Maybe there is some kind of conflict or something else I am missing. Would it be possible to share a backend access to your site (or a staging clone site), so we can look into this directly? It would be the best way we can troubleshoot and get this resolved for you as soon as possible,


    Kind regards,

    Stefan