Woocommerce cart returns to empty after product added

Hi there. I am writing about my site

X Theme and Woocommerce are using most updated versions.

My customers are having trouble adding items to their cart. Once an item is added to cart, the site redirects to an empty cart page.

I have tried disabling plugins, emptying w3 plugin caches, flushing woocommerce Permalinks as well as clearing transients.

I have replicated the issue on Chrome, Firefox and Safari. Please help. I am not a developer and I am not comfortable going any further. Thank you for understanding.

Best,
Melanie
Rumi Sumaq

Hello @rumisumaq,

We have tested our local testing server trying to replicate this issue. It seems that this only happens in your site installation. Since you have already tried troubleshooting the common issues from our guide, can you please put your site in under maintenance mode and disable again all the plugins except WooCommerce? We need to do another round of tests for a plugin conflict. If you wouldn’t mind, we can do a first hand test for plugin conflict to figure out which one is causing this issue.

Kindly let us know your thoughts and if we are permitted to do so. Thanks.

Thanks for taking a look.

Yes, you have my permission to put the site in maintenance mode to test the plugins.

I really need to get this sorted today as many websites will be directing traffic to my site this weekend for a virtual community art show (our new normal).

Many, many thanks for your help!

Hello Melanie,

Thanks for the permission.

However, when I checked your site, it is loaded with plugins and I don’t feel safe deactivating them because it might affect the current setup of your site and it’s a live site.

It would be best to setup a staging site and do the update from there so that the live site will not be affected in case there we disable plugins.

Here are some search results on how to setup a staging site:

https://goo.gl/8BkpJ3

In case you are not certain how to proceed, you might want to check with your web host and ask them if they can help you with the staging site.

Thanks, and please let us know.

Hi Jade,

Thank you. I reached out to Cloudways for help creating a staging site and they took the extra step and investigated the problem for me as well. Turns out, I needed to setup caching exclusions in Varnish.

Here are their recommendations in case it helps others in the forum:

URLExclude: ?add-to-cart=
URLExclude: ^/(cart|my-account/|checkout|wc-api/|addons|logout|lost-password|product/|wp-admin|wp-login)
CookieExclude: woocommerce_cart_hash
CookieExclude: woocommerce_items_in_cart
CookieExclude: wp_woocommerce_session_
CookieExclude: wp-resetpass-

I tested my site and the WooCommerce cart functions and it is now working. Will you kindly confirm the same from your end?

Let me know what you see when adding items to cart.

Thank you!

1 Like

Hey Melanie,

I am so glad that suggestion led you to finding out the cause of the issue and thanks a lot for sharing the solution. This would be helpful for other users who might have the same issue.

I can also confirm that the cart is working on my end as well.

Have a great day and best of luck to your art show this weekend!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.