• Resolved philsafc

    (@philsafc)


    I have a b2b model where multiple users need to login to the same account and place orders. However, if they happen to login at the same time there may already be items in the cart.

    I’ve tried disabling peristent cart with

    add_filter( 'woocommerce_persistent_cart_enabled', '__return_false' );

    but this only clears the cart when someone logs out. So if one user is in the middle of an order and someone else logs in they still have items in their cart.

    How can I prevent this from happening?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Mirko P.

    (@rainfallnixfig)

    Hi @philsafc,

    If you have multiple users accessing the same account there is no way for WooCommerce to determine if that is a different session. That would be basically the same “shared” session for the same user.

    The default options you have are to let users use different usernames, place orders as guests, or not allowing creating orders at the same time by logging in at different times.

    Also, by using a bit of custom coding, you could place a Javascript warning message that the user is placing an order at that exact moment. This though is outside the support of scope we’re able to provide on this forum. If you do require more help with the actual coding, we’d recommend hiring a developer or one of the customization experts listed at https://woocommerce.com/customizations/.

    Thanks.

    Thread Starter philsafc

    (@philsafc)

    Thank you for letting me know. Quite surprising there is no way around this.

    Mirko P.

    (@rainfallnixfig)

    Hi again,

    There must be certainly a way to fix this via custom code but not with the default options available in WooCommerce. Core WooCommerce plugin is highly customizable and you could get in touch with a developer or ask in more development-oriented channels like the WooCommerce Facebook Community group or the #developers channel of the WooCommerce Community Slack. We’re lucky to have a great community of open-source developers for WooCommerce, and many of our developers hang out there, as well.

    Hope this helps.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Stop items in cart being stored in database’ is closed to new replies.