WooCommerce Store API CORS: fix headless carts after 11.3.1
WooCommerce 11.3.1 changed Store API CORS rules for headless storefronts. Learn which calls break, the one-filter fix, the cart-token option and how to troubleshoot.
WooCommerce 11.3.1, released on November 19, 2026, tightened Store API CORS rules. If your storefront runs on a different domain from WordPress, for example a Next.js front end, and the browser sends login cookies to the Store API, those requests now fail unless WordPress explicitly trusts your storefront's origin.
Two kinds of calls are not affected. Calls made from your server, such as a Next.js route handler, never involve CORS. And browser calls that use the Cart-Token header without cookies keep working.
The fix for cookie-based calls is small. Add your exact storefront origin, including https and any www, through the allowed http origins filter in a must-use plugin. Never allow every origin.
When things still break, check for a mismatched origin, preview deployments with their own addresses, or a cache that stores CORS headers for the wrong visitor.
Next step: ask your developer which pattern your store uses, test checkout on staging, then update. If you need help, Crest Design builds and maintains headless WooCommerce stores.
If your WooCommerce store has a separate front end, such as a Next.js or React storefront on its own domain, the WooCommerce 11.3.1 update can stop the cart or checkout from working. This post is for store owners and developers running that kind of headless setup. You'll learn what the WooCommerce Store API CORS change does, which requests it affects, the one-filter fix, and how to troubleshoot the errors that show up afterwards.
What changed in WooCommerce 11.3.1
WooCommerce 11.3.1 shipped on November 19, 2026 as a security release. Among its fixes, it restricts credentialed cross-origin requests to the Store API to origins that WordPress explicitly allows. In plain words: if the browser on shop.example.com calls the Store API on store.example.com and sends the customer's cookies along, WooCommerce now answers only when shop.example.com is on WordPress's list of trusted origins.
The symptom is easy to recognize. The update installs, the WordPress admin looks fine, and then customers report that "Add to cart" does nothing or the checkout spins. The browser console shows a CORS error on a request to /wp-json/wc/store/v1/.... Nothing is wrong with your products or payment gateway; the browser is simply refusing to hand the response to your storefront.
How Store API CORS actually works
CORS is a browser rule, not a server firewall. When JavaScript on one origin (scheme, host and port together) asks for data from another origin, the browser checks the response headers before letting the script read it. For requests that carry cookies, the bar is higher: the server has to name the exact requesting origin and confirm that credentials are allowed. A wildcard isn't accepted.
Before this release, a headless storefront could often rely on the Store API echoing back whatever origin asked. That's convenient, and it's also the reason for the change: a page on an untrusted site could make a logged-in shopper's browser send cookies to your store. WooCommerce now sends the credential headers only when the origin passes WordPress's own allowed_http_origins check.
That gives three very different situations:
- Server-to-server calls. A Next.js route handler, server action or Node.js service calls WooCommerce directly. There's no browser in the middle, so CORS never applies and nothing changes.
-
Browser calls with a cart token. The Store API returns a
Cart-Tokenresponse header from cart endpoints. Your front end stores it and sends it back as a request header, with no cookies. The Store API docs say a nonce isn't needed in this mode, and WooCommerce has exposed the header to cross-origin scripts since version 9.8. The release notes say these requests keep working. -
Browser calls with cookies. The front end uses
fetch()withcredentials: 'include'so WordPress recognizes the logged-in customer. These are the requests that now need an allowlisted origin.
How to fix a headless WooCommerce storefront
Work through these steps on staging first, with the same front end pointed at it.
-
1
Find out which pattern you use. Search the storefront code for
credentials: 'include'and forCart-Token. Also check whether cart calls happen in the browser or in server code. If every Store API call runs on the server, you can stop here. -
2
List your real origins. Write down each storefront address exactly as the browser shows it: production,
wwwand non-wwwif both resolve, and a fixed staging domain. Origins have no path and no trailing slash. -
3
Add them with a must-use plugin. A file in
wp-content/mu-plugins/loads before regular plugins and can't be switched off by accident in the admin. - 4 Update WooCommerce on staging and test. Add to cart, change quantity, apply a coupon, log in, and complete a test order. Watch the browser's network tab for failed requests.
- 5 Repeat on production once staging passes, ideally outside your busiest hours.
For step three, create wp-content/mu-plugins/headless-origins.php, start it with the standard PHP opening tag, paste the lines below and replace the example domains with yours:
/**
* Plugin Name: Headless storefront origins
* Description: Lets the storefront send credentialed requests to the Store API.
*/
add_filter( 'allowed_http_origins', function ( $origins ) {
$origins[] = 'https://shop.example.com';
$origins[] = 'https://staging-shop.example.com';
return $origins;
} );
The filter adds to WordPress's existing list rather than replacing it, so the admin and the site's own origin keep working. Keep the values exact: https://shop.example.com and https://www.shop.example.com are different origins.
Or move guest carts to cart tokens
If most shoppers check out as guests, the cart-token pattern avoids cookies altogether. The front end reads the token from the first cart response and sends it on every later call:
const res = await fetch(`${STORE_URL}/wp-json/wc/store/v1/cart/add-item`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Cart-Token': cartToken, // saved from an earlier cart response
},
body: JSON.stringify({ id: productId, quantity: 1 }),
});
const newToken = res.headers.get('Cart-Token');
Store the token somewhere that survives page loads, such as a first-party cookie on your storefront's own domain, and treat it like a session key: anyone holding it can see and change that cart.
What we've learned from headless WooCommerce builds
In most projects we'd keep cart and checkout calls on the server where we can. A Next.js route handler that talks to WooCommerce avoids CORS entirely, keeps the store's address out of browser code, and gives you one place to add logging. The trade-off is an extra hop, so for product listing pages we often call the public endpoints directly from the browser, since those don't need cookies.
We wouldn't switch logged-in customers to cart tokens just to dodge the allowlist. Account features such as saved addresses depend on WordPress knowing who the customer is, and that's exactly what the allowlisted, credentialed path is for.
The most common mistake is updating production first. A security release feels urgent, and it is, but a headless store needs one staging pass because the break is invisible from the WordPress admin. Our guide to WordPress automatic updates covers how to set an update policy so plugin releases like this one land on staging before production. If you also sell kits, our post on keeping WooCommerce product bundles together in block carts is a useful companion test for the same staging run.
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
| CORS error on cart calls right after updating | The storefront sends cookies and its origin isn't allowlisted | Add the exact origin with the allowed_http_origins filter |
| Origin added, still blocked | A mismatch: www versus none, http versus https, a port, or a trailing slash |
Copy the Origin request header from the network tab and use that exact value |
| Production works, preview deployments fail | Each preview build has its own address | Point previews at a fixed staging domain, or use cart tokens there; don't open the allowlist to patterns you don't control |
| Works for one visitor, fails for the next | A cache or CDN stores CORS headers from another origin's response | Bypass caching for /wp-json/wc/store/ or make sure the cache varies by Origin |
| Cart empties between pages after moving to tokens | The new Cart-Token isn't saved or isn't sent back |
Persist the token after each cart response and send it on every Store API call |
Questions people ask
Does WooCommerce 11.3.1 break every headless store?
No. Only browser requests that send cookies from a different origin are affected. Server-side calls and cart-token calls carry on as before, according to the release notes.
Can I stay on WooCommerce 11.3.0 instead?
You can delay briefly while you test, but 11.3.1 is a security release, so staying behind isn't a good long-term plan. The fix is usually one small file, which is quicker than holding back updates.
Where should the allowlist code live?
In a must-use plugin, not the theme's functions.php. A headless site's theme is often minimal or swapped out, and the allowlist should survive that.
Why this matters for your store
A headless storefront earns its keep through a fast, custom front end, but it adds a contract between two systems that a routine update can quietly change. A failed cart rarely throws an error you'll notice yourself; customers just leave. Having someone who understands both sides, the WordPress plugin layer and the JavaScript front end, turns a release like this into a short staging task rather than a lost weekend. That's the work our WordPress development service and Next.js development team do together, and it pairs naturally with a patching routine like the one in our Next.js security update guide.
Quick checklist: find which call pattern you use, list your exact origins, add them in a must-use plugin, test cart, login and checkout on staging, then update production.
If you'd like a second pair of eyes on your headless WooCommerce setup, get in touch with Crest Design.
(over to you)
Planning a build like this?
Tell us what you're building and we'll come back with ideas and next steps.
Keep reading
All articles
WordPress
· 5 min read
WordPress plugin audit: how to cut plugins without breaking your site
Read article
WordPress
· 7 min read
WordPress automatic updates after 7.1.5: what to check
Read article
WordPress
· 6 min read
WordPress AI features in 2026: Connectors, abilities and the AI plugin
Read article
