Skip to content

Never cache the WooCommerce cart and checkout

Best practices1 min readFixes check woo-cart-cached

A cached cart shows one shopper another's basket and breaks checkout. Exclude /cart/, /checkout/ and /my-account/ at every cache layer, including the CDN.

Step by step, with screenshots: WooCommerce checklist: cart fragments, cache, product schema, stock →

Check your own site

Runs this check and the other 186, free, in about 45 seconds.

What a passing site looks like

  • Cart and checkout bypass the page cachefail · −8 ptseffort M

Cached cart and checkout

Why it matters. A cached /cart/ or /checkout/ shows one visitor another visitor's basket, breaks nonces and payment forms, and produces the "session expired" errors shoppers abandon on. Every caching plugin excludes these pages by default; a CDN or host cache in front of them often does not.

How to fix it.
  1. Exclude /cart/, /checkout/ and /my-account/ (and their translations) from every cache layer: the caching plugin, the host's page cache and the CDN (Cloudflare: a Cache Rule with "Bypass cache" for those paths and for requests with a woocommerce_* cookie).
  2. Re-test after purging: the responses should carry cache-control: no-store or a cache status of BYPASS/MISS.

Filed under WordPress & WooCommerce. Copy is generated from the same catalogue that scores every report, so what you read here is what the report says.