Okay
  Public Ticket #3622150
Cart items being cleared when switch between main acc and subacc
Closed

Comments

  •  2
    Dario started the conversation

    Dear Support Team,

    I am encountering an issue where cart items are being cleared when I switch between my main account and a sub-account, and vice versa. Specifically, if I have items in my cart under my main account and then switch to a sub-account, all items in the cart are lost upon returning to the main account. The same problem occurs in the opposite direction: if I add items to my cart while using a sub-account and then log into that account through the main account, the cart items disappear.

    Is there a solution to ensure that cart items remain persistent regardless of switching between accounts? This functionality is critical for a seamless user experience, especially in a B2B context where switching between accounts may be a common practice.

    Thank you for your assistance.

  •  2,214
    WebWizards replied

    Hello Dario,

    Thank you for purchasing our plugin,


    This is currently an intended behaviour, but we will re-evaluate this to possibly disable it by default,

    In the meantime, you can disable it by adding the following PHP code snippet to your site:

    add_filter('b2bking_empty_cart_on_switch','__return_false');

    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/


    Let me know if this can solve it for you, and whether there is anything else I may be able to help with,


    Kind regards,

    Stefan

  •  2
    Dario replied

    Thanks for solving this.

    Kind regards.

  •  2
    Dario replied

    Hello, I have just purchased Kingsales, and as an agent, when I log into the customer's account, everything in the customer's cart gets deleted. Can you help resolve this issue here as well? Thank you.

  •  2,214
    WebWizards replied

    Hello Dario,

    Thank you for purchasing,


    This requires a similar code snippet to the B2BKing one. Please also add to your site the following snippet:

    add_filter('salesking_empty_cart_on_switch','__return_false');
    

    Kind regards,

    Stefan