WooCommerce Cart Empty After Page Refresh: Why This Happens

design
WooCommerce cart empty after page refresh caused by cookies, caching, CDN issues, sessions, and plugin conflicts

A WooCommerce cart empty after page refresh issue is one of the most damaging problems an online store can have. Customers add products, refresh the page or navigate to checkout, and suddenly the cart is empty. No error. No warning. Just lost intent and lost revenue.

This issue almost always comes down to sessions, cookies, caching, or server configuration. WooCommerce relies on these systems to persist cart data between page loads. When even one of them fails, the cart cannot be restored.

This guide explains why the WooCommerce cart becomes empty after page refresh, what actually breaks under the hood, and how to fix each cause properly.


How WooCommerce Stores Cart Data

WooCommerce does not store cart contents in the database by default. Instead, it uses:

  • PHP sessions
  • Browser cookies
  • AJAX calls
  • Server-side session storage

If sessions or cookies fail, WooCommerce has no way to remember the cart.

External reference on WooCommerce session handling:


Cause 1: Cookies Not Being Saved Properly

This is the most common cause of the cart emptying after refresh.

WooCommerce relies on cookies such as:

  • woocommerce_cart_hash
  • woocommerce_items_in_cart
  • wp_woocommerce_session_*

If these cookies are blocked, cleared, or not persisted, the cart resets.

Why Cookies Fail

  • HTTP vs HTTPS mismatch
  • Incorrect site URL settings
  • CDN or caching misconfiguration
  • Browser cookie restrictions
  • Cross-domain issues

External reference on browser cookies:

How to Fix It

  • Ensure the site runs fully on HTTPS
  • Confirm WordPress Address and Site Address match exactly
  • Avoid mixing www and non-www
  • Test cookies in an incognito window
  • Disable CDN temporarily and retest

Cause 2: Caching the Cart or Checkout Pages

Caching is another top offender.

If the cart page is cached, WooCommerce serves a stale version of the cart that does not reflect the current session. On refresh, the cached version overwrites the live cart.

Pages That Must Never Be Cached

  • Cart
  • Checkout
  • My Account

This mistake is extremely common with aggressive caching plugins or server-side caching.

Related optimization guide:

External reference on WooCommerce caching rules:

How to Fix It

  • Exclude cart and checkout URLs from cache
  • Disable page caching for logged-in users
  • Disable cache for URLs containing ?add-to-cart=
  • Clear all caches after changes

Cause 3: Sessions Not Persisting on the Server

WooCommerce sessions are stored server-side. If the server cannot persist sessions, the cart disappears on reload.

Common Server Issues

  • Sessions stored in /tmp and getting purged
  • Object cache misconfiguration
  • Low disk space
  • PHP session handler misconfigured

External reference on PHP sessions:

How to Test

  • Add an item to cart
  • Refresh the page
  • Check if the wp_woocommerce_session_* cookie changes every load

If the session ID keeps changing, sessions are not persisting.


Cause 4: admin-ajax.php or AJAX Requests Failing

WooCommerce relies on AJAX to update and restore cart fragments.

If admin-ajax.php is blocked or failing, the cart may appear empty after refresh.

This is often tied to:

  • Security plugins
  • Hosting firewalls
  • CDN rules
  • AJAX 400 or 403 errors

Related deep dive:

External reference on WordPress AJAX:

How to Fix It

  • Check browser Network tab for failed admin-ajax requests
  • Disable security plugins temporarily
  • Whitelist admin-ajax.php in firewalls
  • Bypass CDN rules for AJAX endpoints

Cause 5: Mixed Content or SSL Issues

If parts of your site load over HTTP and others over HTTPS, cookies may not be saved correctly.

Symptoms:

  • Cart works until refresh
  • Cart clears on navigation
  • Cookie warnings in browser console

External reference on mixed content:

Fix

  • Force HTTPS site-wide
  • Replace hardcoded HTTP assets
  • Update database URLs if needed

Cause 6: Plugin Conflicts Modifying Cart Behavior

Plugins that touch cart logic can easily break session handling.

Common plugin categories:

  • Dynamic pricing plugins
  • Currency switchers
  • Cart customization plugins
  • Analytics and tracking tools

Debugging Steps

  1. Disable all plugins except WooCommerce
  2. Test cart behavior
  3. Re-enable plugins one by one

Cause 7: CDN or Reverse Proxy Issues

CDNs like Cloudflare can cache cookies or strip headers if not configured correctly.

Common CDN problems:

  • Cache Everything rules
  • Cookie stripping
  • Aggressive edge caching
  • Bot protection interfering with sessions

Fix

  • Disable caching for cart and checkout
  • Allow WooCommerce cookies
  • Bypass cache for logged-in users

Cause 8: REST API or Loopback Failures

WooCommerce depends on internal loopback and REST API calls. If these fail, session handling can break.

Check:

  • Tools → Site Health
  • REST API errors
  • Loopback request errors

External reference on WordPress Site Health:


How to Debug the Cart Empty Issue Properly

Follow this order to avoid guessing:

  1. Test cookies in browser DevTools
  2. Disable caching and CDN
  3. Check admin-ajax requests
  4. Test with default theme
  5. Disable all plugins except WooCommerce
  6. Verify HTTPS and URLs
  7. Check server session storage

This approach finds the root cause quickly.


When This Issue Breaks Checkout Too

A cart empty after refresh often leads to checkout failures, infinite loaders, or orders not being created.

Related post:


When You Need Developer-Level Help

If the cart keeps clearing after:

  • Cache exclusions
  • Plugin isolation
  • CDN testing
  • Server checks

then the issue is almost always hosting-level or custom-code related.

At that point, debugging without logs and server access wastes time and revenue.

Contact Me

Frequently Asked Questions About WooCommerce Cart Empty After Page Refresh

A WooCommerce cart becomes empty after page refresh when sessions or cookies are not being saved correctly. This is usually caused by caching, HTTPS issues, CDN interference, blocked cookies, or server-side session problems.

Yes, caching is one of the most common reasons. If the cart or checkout page is cached, WooCommerce serves a stale version of the page, which resets the cart on refresh. Cart and checkout pages should never be cached.

WooCommerce relies on cookies such as woocommerce_cart_hash, woocommerce_items_in_cart, and wp_woocommerce_session_*. If these cookies are blocked, cleared, or not persisted, the cart will empty on refresh.

Yes. If your site mixes HTTP and HTTPS or has incorrect site URL settings, WooCommerce cookies may not be saved properly. This often causes the cart to disappear after a page reload.

Yes. WooCommerce uses admin-ajax.php to update and restore cart fragments. If admin-ajax.php requests fail due to security plugins, firewalls, or CDN rules, the cart may appear empty after refresh.

Yes. CDNs like Cloudflare can cache cart pages, strip cookies, or block AJAX requests if not configured correctly. This commonly leads to WooCommerce cart session issues.

Yes. Plugins that modify pricing, cart behavior, currency, or checkout logic can interfere with WooCommerce sessions and cause the cart to clear on refresh.

Add a product to the cart, refresh the page, and check the browser’s cookies. If the wp_woocommerce_session_* cookie changes on every load, sessions are not persisting correctly on the server.

Yes. Hosting environments with misconfigured PHP sessions, aggressive server caching, or limited session storage can cause WooCommerce carts to reset after page refresh.

No. WooCommerce stores cart data in sessions and cookies by default, not in the database. If sessions fail, WooCommerce cannot restore the cart after refresh.

Meet the Author

Babar khan

Babar Ilyas is a full-stack WordPress developer and SEO strategist focused on building fast, functional, and search-optimized websites. With years of hands-on experience, he shares real-world fixes and dev workflows that actually work.
When he’s not deep in code, he’s dropping fresh blog posts and tracking what Google’s up to — one ranking at a time.
Leave a Reply

Your email address will not be published. Required fields are marked *

    Branding Design Development Front-End Website-Redesigning Shopify-Development WordPress-Development
    Branding Design Development Front-End Website-Redesigning Shopify-Development WordPress-Development
    We love crafting unforgettable
    digital experiences, brands and websites with people like you.
    Follow us:
    Let’s get started
    We'd love to hear about your project.
    © 2025 babarilyas. All rights reserved.