WooCommerce Cart Shows Empty After Adding Products: Causes and Fixes
Quick Answer: How to Fix an Empty WooCommerce Cart
When customers add products to their cart but the cart page repeatedly shows as empty, the underlying issue is almost always caused by improper page caching or dropped PHP user sessions. Static caching layers (such as Varnish, Nginx FastCGI, or WordPress caching plugins) often serve a cached, static copy of the dynamic cart page or block the dynamic session cookies WooCommerce depends on.

To fix this immediately: exclude the dynamic WooCommerce endpoints (/cart, /checkout, and /my-account) and the session cookie wp_woocommerce_session_ from all caching layers. If the issue persists, clear customer transients in WooCommerce settings and flush site rewrite rules by re-saving your WordPress permalinks.
Common Causes of the WooCommerce Empty Cart Issue
WooCommerce requires real-time server processing and cookie persistence to track user session data across pages. When products fail to persist in the shopping cart, the root cause usually falls into one of these categories:
- Server or Plugin Caching: Caching the dynamic cart page prevents the web server from processing PHP code to display active session items.
- PHP Session and Cookie Drops: Unconfigured PHP session save paths or browser cookie blocks prevent
wp_woocommerce_session_cookies from storing cart state data. - Unassigned Pages or Missing Shortcodes: If WooCommerce pages are unassigned or the cart page lacks the proper
[woocommerce_cart]shortcode or block, items will not display. - Outdated Theme Overrides: Custom theme files overriding core WooCommerce templates in the
/woocommercedirectory can break cart mechanics following updates. - Broken Rewrite Rules: Corrupted permalink endpoint parameters can disconnect the add-to-cart action from the cart page redirect.
Step-by-Step Troubleshooting Guide
1. Exclude WooCommerce Pages and Cookies from Cache
According to official WooCommerce caching documentation, dynamic e-commerce endpoints must never be cached. If dynamic endpoints are cached, users will see static HTML renders rather than their active sessions.
Ensure your server configuration (such as Varnish or Nginx FastCGI) and WordPress caching plugins (like WP Rocket or W3 Total Cache) exclude the following pages from caching:
/cart//checkout//my-account/
Additionally, ensure your caching software excludes session cookies matching the pattern wp_woocommerce_session_. If you suspect your issue stems from caching layer mismatches on live pages, review our guide on Elementor changes not showing on live site for similar browser and server cache diagnostics.
2. Clear WooCommerce Transients and Sessions
If session data in the WordPress database becomes corrupted, users may be trapped in a state where items cannot attach to their session ID. According to the WooCommerce System Status documentation, you can clear this data directly from the WordPress administration dashboard.
Navigate to WooCommerce > Status > Tools and locate the following diagnostic utilities:
- Clear WooCommerce Transients: Flushes internal product and session caches.
- Clear Expired Transients: Removes outdated transient records from the
wp_optionstable. - Clear Customer Sessions: Clears active cart sessions across the database.
Caution: Flushing customer sessions will immediately reset shopping carts for active site visitors and log them out of open shopping sessions.
3. Verify WooCommerce Page Assignments and Shortcodes
If WooCommerce does not know which page acts as the designated cart, adding products to the basket will fail to render data upon redirection.
- Go to WooCommerce > Settings > Advanced.
- Check the Page Setup tab to ensure the Cart Page is correctly designated.
- Navigate to Pages > All Pages and edit your designated Cart page.
- Ensure the content area contains either the core WooCommerce Cart Block or the classic shortcode:
[woocommerce_cart].
4. Reset WordPress Permalinks
As detailed in technical breakdowns by Business Bloomer, endpoint space errors and broken URL rewrite rules can interrupt the add-to-cart process. Flushing permalinks refreshes these rewrite endpoints without destroying data.
- Log into your WordPress Dashboard.
- Navigate to Settings > Permalinks.
- Without changing any settings, scroll to the bottom and click Save Changes.
5. Test for Plugin and Theme Conflicts
Outdated theme files residing in your theme's /woocommerce directory can conflict with recent core WooCommerce updates. Additionally, security plugins or custom code snippets can inadvertently block session cookies.
- Temporarily switch your active theme to a core default theme such as Storefront or Twenty Twenty-Four.
- Deactivate all third-party plugins except WooCommerce.
- Open an incognito or private browser window and attempt to add a product to your cart.
- If the cart retains the product, reactivate your plugins one by one to identify the conflicting plugin.
If your store experiences broader checkout failures after fixing the cart, refer to our troubleshooting steps for WooCommerce checkout stuck loading.
When to Contact Hosting Support
If you have verified that dynamic pages are excluded from caching and sessions remain broken, the underlying issue may rest at the host environment level. Contact your web host support team to check the following server configurations:
- PHP Session Path: Ensure the server's
session.save_pathdirectory is writable and configured properly. - Object Caching: Ask your host to flush server-side object caches (such as Redis or Memcached) that might be retaining stale session data.
- Database Health: Request a check for corrupted tables if transient data fails to clear. If your database fails to connect entirely, check our tutorial on WordPress error establishing a database connection.
Sources & References
- Configuring Caching Plugins for WooCommerce - WooCommerce Official Documentation
- WooCommerce System Status Tools - WooCommerce Official Documentation
- WooCommerce: How to Fix the 'Cart is Empty' Issue - Business Bloomer
Comments
Post a Comment