• Is there a way to turn off the persistent cart (shopping cart saved in usermeta table for later use) feature in WooCommerce without updating the plugin core files?

    One of my client websites (an association) uses a single generic login account for about 200 users to access member content. The persistent cart feature follows the user. As a result each member will “share” the same shopping cart. What I need is to only store the cart information locally on the computer the user is on (e.g., sessions) and so not tie it to the account.

    I’ve been able to successfully accomplish this by commenting out the persistent cart update code in the WC_cart class. This is obviously a very bad solution but I did not see where the vendor allows turning this thing off, either programatically, through some define, or using an admin option.

    I don’t think my case is that rare though I do think it is uncommon. I would think other would want to turn off this feature too.

    Thanks.

    https://www.ads-software.com/plugins/woocommerce/

Viewing 5 replies - 1 through 5 (of 5 total)
  • We would love to hear an answer to this, we are experiencing the same ‘problem’.

    Have you accomplished this @anterys?

    Rowan

    Thread Starter anterys

    (@anterys)

    Hi Dynadata. I did but not in any way that is recommended. I never got a response to this question and the requirement was firm with the client so I was forced to update the WooCommerce core files. It was a simple change that could be quickly and easily redone with new versions of the plugin.

    The fix is to simply comment out any an all calls to the function update_user_meta within the plugin. And just to be safe, I commented out the persistent cart action (the following line in woocommerce-hooks.php.

    add_action( 'wp_login', 'woocommerce_load_persistent_cart', 1, 2 );

    I’m a little surprised that it’s not possible to turn this off in the options although I have not researched it in 7 months so it might be now.

    Thanks for the quick reply!

    I’ve tried the same thing, since there apparently is no filter/action whatsoever so I can change the functionality for the Persistent Cart.

    I have tried editing the core files to remove the functionality, but it somehow the cart is still persistent.

    Obviously I’m not a fan of editing the core files, so this clearly isn’t a solution for long term, but I thought maybe you’d have found a different solution.

    I guess I will post this link to the ideas forum for Woocommerce and hope they will implement it in future updates.

    Again thanks for the info.

    Rowan

    Thread Starter anterys

    (@anterys)

    You may try clearing your cache and deleting your cookies to fix the issue with the persistent cart still appearing.

    Hopefully the WooThemes guys also find it a good solution.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Turn off persistent cart’ is closed to new replies.