Introduction
WooCommerce carts depend on session cookies and user-specific fragments. If a page cache or CDN treats cart pages like static content, shoppers receive stale HTML that does not match their session, so the cart looks empty, totals revert, or checkout behaves inconsistently across refreshes.
Symptoms
- Products are added successfully, then disappear on the next page view
- The cart works in one browser but not another because of cached pages
- Checkout totals or mini-cart fragments are inconsistent across refreshes
- The issue worsened after enabling a caching plugin, reverse proxy, or CDN rule
Common Causes
- Full-page cache does not bypass WooCommerce session cookies
- Cart, checkout, or account routes are cached at the server or CDN layer
- Edge cache rules ignore
woocommerce_cart_hashor related cookies - Fragment caching is serving stale HTML after cart state changes
Step-by-Step Fix
- 1.Verify that cart pages are being cached
- 2.Look for cache headers or repeated stale HTML before changing WooCommerce itself.
curl -I https://example.com/cart/
curl -I https://example.com/checkout/- 1.Exclude WooCommerce routes from page caching
- 2.Cart, checkout, and account routes should bypass cache entirely.
location ~* ^/(cart|checkout|my-account)/ {
add_header Cache-Control "no-store";
}- 1.Bypass cache when WooCommerce cart cookies are present
- 2.A shopper with WooCommerce session cookies should not receive a shared cached page.
if ($http_cookie ~* "woocommerce_items_in_cart|woocommerce_cart_hash|wp_woocommerce_session_") {
set $skip_cache 1;
}- 1.Purge caches and retest the full add-to-cart flow
- 2.After the bypass rules are in place, clear plugin, server, and CDN caches before testing again.
wp cache flushPrevention
- Treat WooCommerce cart and checkout flows as dynamic from day one
- Align cache-bypass rules across plugin cache, reverse proxy, and CDN layers
- Regression test add-to-cart and checkout after every cache optimization change
- Document the exact WooCommerce cookies that should bypass caching