MageSentinel

Cloudflare and WooCommerce: caching and bot rules that break checkout

Putting a WooCommerce store behind Cloudflare or another CDN is one of the best speed improvements available. It also adds a layer that can cache personal pages, challenge real customers or rewrite the checkout’s JavaScript.

All posts1 min read

Twisted network cables

Caching the wrong pages

“Cache everything” rules are great for product pages and dangerous for cart, checkout and my-account. Bypass the cache for those paths and whenever WooCommerce cart or session cookies are present — the Cloudflare cache documentation covers rules and bypass.

The symptoms are the same as a misconfigured full page cache on Magento: empty carts, someone else’s cart, expired nonces.

Bot protection

Bot fight modes and challenges can block payment provider webhooks, the Store API and monitoring tools. Customers on VPNs or corporate networks may get challenges on the checkout itself.

Allow payment providers’ callbacks through, and avoid challenges on checkout paths unless you are under a card testing attack.

Edge optimisation

Features that minify, defer or rewrite JavaScript at the edge can break payment scripts the same way optimisation plugins do. Exclude checkout pages or disable those features and let the site handle optimisation.

After every CDN change, test a full purchase in a private window. A scheduled external check shows a CDN challenge as UNKNOWN and a broken script as a failure — two different problems, clearly separated.

Check your own store now with the free WooCommerce checkout checker: it walks the checkout in a real browser and shows the step where it stops.

Common questions

Which WooCommerce pages should Cloudflare not cache?

Cart, checkout, my account, and any request with wc-ajax or the woocommerce_items_in_cart and wp_woocommerce_session cookies.

Can Cloudflare bot protection block payments?

Yes. Bot Fight Mode or challenges can block payment provider callbacks and Store API requests; skip them for those paths.

Does Rocket Loader break WooCommerce checkout?

It can, by changing script load order; exclude checkout scripts or turn it off for the checkout page if payments or totals fail.