All posts

Cloudflare WAF blocking WooCommerce checkout and coupon AJAX: how to confirm it and fix it

The checkout loads, the customer types an address, and the totals never update. Or the coupon box spins and nothing happens. Or Place order shows a generic error. The page itself came through Cloudflare fine; the background calls behind it did not. To fix it, confirm the firewall is the cause, exempt those requests, and check the one Cloudflare setting that no rule can exempt.

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 · 5 min read
Network cables in a server rack

Which WooCommerce requests the WAF breaks

The classic checkout does its work in AJAX calls to ?wc-ajax=…. The Blocks cart and checkout use the Store API under /wp-json/wc/store/v1/. All of them are POSTs sent by JavaScript, and all of them expect JSON back.

RequestWhat it doesSymptom when challenged
?wc-ajax=update_order_reviewRecalculates shipping, tax and totals when the address changesTotals and shipping methods never load
?wc-ajax=apply_couponApplies a coupon codeCoupon spinner, no message
?wc-ajax=checkoutPlaces the orderGeneric error on Place order
?wc-ajax=get_refreshed_fragmentsUpdates the mini cartCart count stuck
/wp-json/wc/store/v1/cart/apply-couponCoupon on the Blocks cartCoupon fails silently
/wp-json/wc/store/v1/checkoutPlaces the order on the Blocks checkoutOrder not placed

A browser can solve a challenge on a full page. It cannot solve one inside an AJAX call: the script receives an HTML challenge page with status 403, fails to parse it as JSON and shows a spinner or a generic error.

Confirm the firewall is the cause

  1. Open the browser network tab. Reproduce the problem and find the failing wc-ajax or wc/store request. A Cloudflare challenge answers 403 with an HTML body and a cf-mitigated: challenge response header.
  2. Note the Ray ID. It is in the cf-ray response header and at the bottom of the challenge page.
  3. Find the event. In the Cloudflare dashboard, Security → Events, filter by that Ray ID or by the path. The event names the service that acted: custom rule, managed rules, rate limiting, or bot protection.

You can check from a terminal too. The header only appears when Cloudflare itself challenged the request:

bash
curl -s -o /dev/null -D - -X POST "https://example.com/?wc-ajax=update_order_review" \
  | grep -i -E "^HTTP|cf-mitigated|cf-ray"
A bare 403 with the body -1 is WooCommerce rejecting the missing nonce, not Cloudflare.
Partial blocks are the norm

Firewall blocks often hit only some buyers: one country, a mobile network, a VPN, or a carrier NAT that shares one IP among thousands. "It works for me" does not rule out the WAF.

The skip rule for wc-ajax and the Store API

In Security → WAF → Custom rules, create a rule with the Skip action, placed first, with this expression:

txt
(http.request.uri.query contains "wc-ajax=")
or starts_with(http.request.uri.path, "/wp-json/wc/store/")
Add your payment gateway's webhook path, for example /wc-api/ or the plugin's REST route.

Under "WAF components to skip", pick what is actually blocking, as named in the event: the remaining custom rules (for a challenge rule or a country rule), and Super Bot Fight Mode on paid plans. Keep the managed rules running if you can; for a managed-rule false positive, use an exception scoped to the path and rule ID instead (next section).

Bot Fight Mode cannot be skipped

The free plan's Bot Fight Mode ignores custom rules, so no skip rule helps. If the events show Bot Fight Mode on checkout requests, turn it off (Security → Bots) or move to Super Bot Fight Mode on a paid plan, which a skip rule can bypass.

Rate limiting rules on wc-ajax are a common cause of coupon failures: a limit sized for one visitor trips for a shared IP. Scope coupon limits to repeated failures, not every call, and see card testing attacks for protection that does not hurt buyers.

Managed rules that fire on customer data

OWASP-style signatures match ordinary input: an apostrophe in O'Brien, a street name with SQL keywords, long order notes, a coupon code with special characters. Cloudflare logs the rule ID in the event. Add a managed rules exception for that rule ID on the checkout path only, rather than switching the ruleset off.

In ModSecurity the same applies: find the rule id in the audit log and exclude that parameter on that path. Wordfence and similar plugins can rate-limit AJAX calls when many buyers share one IP; raise the limits for the checkout endpoints. More in security plugins blocking checkout.

Payment callbacks and Magento

Gateways confirm payments with server-to-server calls to your store. A country block, bot rule or rate limit on that call leaves the customer charged and the order in pending payment. Allow the exact callback path or the provider's published IP ranges. See WooCommerce orders stuck in pending payment and Magento orders stuck in pending payment.

On Magento the paths to exempt are /rest/*/V1/carts/*, /rest/*/V1/guest-carts/*, /checkout/*, /customer/section/load and each payment module's callback URL.

Caching and Rocket Loader cause a different set of checkout failures behind Cloudflare; they are covered in Cloudflare and CDNs breaking WooCommerce checkout.

Test from outside after every rule change

Firewall changes are invisible from the admin, and your own IP is often allowlisted. After each change, run a full checkout with a coupon from a clean browser on another network, or let an external check do it. The free WooCommerce checkout checker and Magento checkout test run from outside your network and show the step where a block hits.

Find out your checkout broke before your customers do.

Real checkout checks for Magento and WooCommerce · free plan · no card required
FAQ

Common questions

Still have a question?More answers, and a way to reach us.Support →
01Can Cloudflare block WooCommerce checkout AJAX?

Yes. A challenge on a wc-ajax or Store API request returns an HTML page where the checkout expects JSON, so totals, coupons or Place order fail.

02Why does the coupon not apply behind Cloudflare?

The apply_coupon call is being challenged or rate-limited. Check Security → Events for that path and add a skip rule or a scoped exception.

03How do I know the firewall is the cause?

The failing request returns 403 with a cf-mitigated: challenge header and a Ray ID that you can find in Security → Events.

04Can I skip Bot Fight Mode for the checkout?

No. The free Bot Fight Mode ignores custom rules. Turn it off, or use Super Bot Fight Mode on a paid plan and skip it for the checkout paths.