Introduction
Cloudflare Cache Everything can improve page speed on mostly static sites, but it breaks storefronts when applied broadly to WooCommerce. Cart, checkout, account, and session-driven pages become edge-cached HTML, so users see stale cart states, wrong totals, or failed checkout steps.
Symptoms
- WooCommerce cart counts or totals are inconsistent across page loads
- Customers report empty carts or items from a previous session
- The issue started after enabling a Cloudflare Cache Everything rule
- Direct origin access works better than the public Cloudflare-served URL
Common Causes
- A Cache Everything rule is matching cart, checkout, or account pages
- Edge cache rules do not account for WooCommerce session cookies
- The storefront relies on dynamic fragments but Cloudflare serves a shared page
- Origin cache bypass rules are correct, but Cloudflare still caches at the edge
Step-by-Step Fix
- 1.Check whether Cloudflare is caching the dynamic page
- 2.Inspect the response headers from the public site rather than from the origin directly.
curl -I https://example.com/cart/
curl -I https://example.com/checkout/- 1.Exclude WooCommerce paths from Cache Everything
- 2.Cart, checkout, and account routes should bypass Cloudflare edge caching entirely.
Expression example:
(http.request.uri.path contains "/cart") or (http.request.uri.path contains "/checkout") or (http.request.uri.path contains "/my-account")- 1.Bypass edge caching when WooCommerce session cookies are present
- 2.Cookie-aware bypass rules are essential for dynamic storefront behavior outside the obvious cart routes.
http.cookie contains "woocommerce_items_in_cart" or http.cookie contains "woocommerce_cart_hash" or http.cookie contains "wp_woocommerce_session_"- 1.Purge Cloudflare cache and re-test add-to-cart
- 2.Existing stale edge content can linger until you purge it after the rule update.
curl -X POST "https://api.cloudflare.com/client/v4/zones/<zone-id>/purge_cache"Prevention
- Do not apply Cache Everything broadly to e-commerce paths
- Align Cloudflare cache bypass logic with WooCommerce session cookies
- Regression test cart and checkout after every edge caching change
- Use page rules or cache rules only on truly static storefront pages