[SOLVED] Your Cart Is Currently Empty Error – WooCommerce

How To Fix “Empty Cart” WooCommerce Error

Hello visitor,

Today I will talk about the following WooCommerce (annoying) error: Your cart is currently empty.

This issue may appear from different reasons, such updating the WooCommerce plugin, updating the WordPress version, a plugin conflict between WooCommerce and “x” plugin, due to a cache problem and so on.

Your Cart Is Currently Empty Error – “Cache issue” Scenario

Let’s say you just create your own online store with the WooCommerce plugin. Like any other site developer, you go to your site from another browser/device/incognito, to test the functionality of the site and you discover that once you add a new product in the cart, nothing happen. The only message you get is: “Your cart is currently empty”. After that, you try to buy from your developer account, and it works: The product is added in the cart. This kind of error is generated, in most of the cases, by a cache issue. Basically, your cart page is not refreshing with the new information.

Before showing 2 potential fixes, go to Wp-dashboard -> WooCommerce -> Status -> Make sure everything is OK (any red flag must be solved).

How To Fix “Your Cart Is Currently Empty” Issue:

FIX 1. Cache Plugin and WooCommerce pages

If you are using a cache plugin, try to exclude the WooCommerce pages (shop, cart and checkout). If you are caching these pages, you may get this error. If you initially included them and now you just excluded these pages from the cache, purge the cache of the site and also clean the browser cache.

FIX 2. CloudFront and WooCommerce

This fix isn’t apply only for CloudFront CDN, but also for any other CDNs. The problem is the CDN cache some important cookies and don’t allow that page (cart, etc) to be refreshed. To solve the empty cart error (again, this is apply for CloudFront, but it is similar to any other CDN), go on your AWS CloudFront account and follow these steps:

*Find the CloudFront Distribution related to your site and edit it.

CloudFront Distribution
CloudFront Distribution

*Locate the ‘Behaviors’ TAB and open it.

*Locate the 'Behaviors' TAB and open it.
*Locate the ‘Behaviors’ TAB and open it.

*Locate the ‘default(*)’ behavior and open it.

*Locate the 'default(*)' behavior and open it.
*Locate the ‘default(*)’ behavior and open it.

*Add the following cookie to the list: Add “wp_woocommerce_session_*” – Without quotes

CloudFront wp_woocommerce_session_*
CloudFront wp_woocommerce_session_*

 

Extra tip: If you want to avoid similar issues, add these cookies to the whitelist, too:

"woocommerce_items_in_cart*"
"woocommerce_cart_hash*"
"woocommerce_recently_viewed*"
"wp-resetpass*" (for WP password resets)

Wait a few minutes to deploy and check it again (from incognito). It should be fixed right now.

Your Cart Is Currently Empty Error – Other Ways To Fix

First of all, I am not a fan of installing a ton of plugins. But, if this will solve your issue, it’s up to you how many plugins do you want to keep on your site. So, add and install this plugin: Ajax add to cart for WooCommerce. If it don’t solve the issue, try other ways from the list below.

  1.  Have you installed any plugin just before this issue appeared? If so, deactivate it, clean the cache and test. Maybe that plugin is in conflict with WooCommerce. You can also deactivate all plugins and keep active just the WooCommerce plugin.
  2.  Page structure: Make sure the hierarchy of the pages is the right one: Shop -> Cart -> Checkout. Ideally, Cart and Checkout page should be configured without a parent page.
  3.  www/non-www – Make sure the domain configuration corresponding with the WooCommerce settings. For example, if your domain is set to yoursite.com and in the WooCommerce settings the domain is configured to www.yoursite.com, try edit it and configure to yoursite.com.
  4.  If you are using a translation plugin, such WPML, All languages, etc, make sure you set the WooCommerce pages (shop, cart, checkout, etc) to each new language you add. Usually, these pages aren’t configured for all languages, but only for English.
  5.  After a WooCommerce migration, make sure the database tables are ok. For example, make sure wp_woocommerce_sessions table is set to “AUTO INCREMENTING”. To access it, go to: cPanel -> PHPmyadmin -> Your site db -> table.
  6.  Theme conflict – Try to temporary change the theme to Twenty Twenty-One theme. If everything is fine, return to your main theme.
  7.  Check if on the WooCommerce checkout endpoints. There shouldn’t be any spaces in your Endpoint URL. For example, “ORDER PAY” is not good. “ORDER-PAY” is good. To check the checkout endpoints, go to WooCommerce -> Settings -> Advanced -> and locate “checkout endpoints”.

If it don’t want to be fixed, delete the WooCommerce pages and recreate them. To recreate the WooCommerce pages, go to WooCommerce -> Status -> Tools and click on “Create default WooCommerce pages”.

That’s it!

Tags: , , , , ,
Menu