WordPress WooCommerce Empty Cart Problem

WooCommerce Cart Empty

I had the empty cart or empty basket issue recently that completely stumped me for a while.  Given the many years I have been working with WordPress it should not have done but it look a bit of time to work out.   It’s often the stuff that is staring you in the face that is the hardest to get sorted.

Have you every found you have a situation where a visitor can add an item to the shopping cart but they go to check their basket it is empty?

I did a couple of searches online and it went from the usual disabling of everything in the site (which is a bit like turning off the power for 30 seconds and turning it back on again, rarely works!) to being a massive PHP problem.  Once person had actually downgraded their version of PHP and swore this solved the issue, which it probably would have done for five minutes. One forum stated that WooCommerce and PHP 7.0 were not compatible, which of course is completely rubbish!  Some people had uninstalled and reinstalled WooCommerce with differing levels of success.

It was all about caching

The answer for me was pretty simple, I found it was down to caching.  If you are using a caching plugin you just need to exclude the WooCommerce pages from being cached.  There will be an area within the plugin settings that you can do this.  You just need to add https://yourdomain.com/basket/ and https://yourdomain.com/checkout/ to the list of pages that don’t get cached.  Then clear the cache for good measure. If you are with WPEngine they will do it for you if you log in and contact them via live chat.

So simple when you think about it.  How else could a basket be empty when you know it isn’t?

© Copyright protected by Copyscape.