All posts

Cloudflare and CDNs breaking WooCommerce checkout

Cloudflare and other CDNs make a WooCommerce store faster and safer. Configured for a brochure site, they also cache pages that differ per customer, challenge requests the checkout needs, and rewrite the scripts payment gateways depend on. The store looks fine from the outside; orders stop.

Free checkout scan

Enter your store address. A real browser adds a product to the cart and walks the checkout up to the payment step, like a customer, and shows you every step with a screenshot.

  • Free, no account
  • Stops before payment, no order
  • Nothing to install
· Updated · 2 min read
Twisted network cables

Caching the wrong pages

Path or requestAt the edge
Product and category pages, static assetsCache
/cart/, /checkout/, /my-account/Bypass
?wc-ajax=* (update_checkout, checkout, fragments)Bypass
/wp-json/wc/store/* (block cart and checkout)Bypass
Requests with woocommerce_items_in_cart or wp_woocommerce_session_* cookiesBypass
/wp-admin/, /wp-login.phpBypass

A “Cache Everything” rule without these exceptions serves one customer’s cart, or an empty checkout, to everyone. Symptoms: cart counts that do not change, totals that do not update, “session expired” on Place Order.

bash
# A checkout response must not come from the edge cache
curl -sI https://example.com/checkout/ | grep -i cf-cache-status
# expected: DYNAMIC or BYPASS, never HIT

Bot protection

Bot Fight Mode, managed challenges and WAF rules can answer the checkout’s background requests with a challenge page instead of JSON. The browser cannot solve a challenge inside an AJAX call, so the checkout spins or shows a generic error.

Payment webhooks are bots too

Gateways confirm payments with server-to-server calls to /?wc-api=… or /wp-json/…. Challenge those and orders stay pending even though the customer paid. See payment gateway failing.

Add a WAF skip rule for the checkout endpoints and the gateway’s webhook path, and check Security → Events for challenges on wc-ajax or wc/store requests. The exact rule, and how to confirm the block, are in Cloudflare WAF blocking WooCommerce checkout AJAX.

Edge optimisation

Rocket Loader, script minification and email obfuscation change the JavaScript the checkout runs. Payment fields from Stripe, PayPal and others load in iframes from their own scripts; a deferred or rewritten script loads them late or not at all.

  1. Turn off Rocket Loader for the checkout. Use a Configuration Rule on /checkout/*, or turn it off site-wide.
  2. Exclude gateway scripts from optimisation. In Cloudflare and in any WordPress optimisation plugin.
  3. Purge after each change, then test. A full checkout with each payment method, in a private window.

Related: cart fragments and performance and update_checkout not working.

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

Find out your checkout broke before your customers do.

Real checkout checks for Magento and WooCommerce · free plan · no card requiredWooCommerce checkout monitoring →
FAQ

Common questions

Still have a question?More answers, and a way to reach us.Support →
01Which WooCommerce pages should Cloudflare not cache?

Cart, checkout and my-account, every wc-ajax request, the Store API under /wp-json/wc/store/, and any request carrying WooCommerce session cookies.

02Can Cloudflare bot protection break checkout?

Yes. A challenge returned to an AJAX checkout request or a payment webhook breaks the order. Skip those paths in the WAF.

03Does Rocket Loader break WooCommerce payments?

It can, by delaying or rewriting payment gateway scripts. Turn it off for the checkout.