On this page
Why this happens
Many older AJAX examples assume the storefront lives at the domain root. A translated or regional storefront can have a path prefix, and hardcoded URLs can send requests or navigation outside the intended context. A successful English test does not establish that localized requests are correct.
How to fix it
Search theme assets and snippets for literal cart/add.js, cart/change.js, cart.js, search and cart links. Build Ajax paths from the runtime root, preserving its trailing slash. Use routes.cart_url and routes.cart_add_url for Liquid links and forms. Preserve the current page context when requesting section HTML. Review app-generated requests separately rather than changing vendor code blindly.
Practical example
For a read-only cart check, use fetch(window.Shopify.routes.root + 'cart.js').then(r => { if (!r.ok) throw Error(r.status); return r.json(); }). For writes, use the same root with cart/add.js or cart/change.js and the appropriate POST body. In Liquid, a cart link can use {{ routes.cart_url }}. Run Theme Check to catch hardcoded Liquid routes.
- Preview a duplicate theme in the default language and a published secondary language
- inspect request URLs in DevTools
- add, change and remove an item
- compare cart totals and translated section HTML
- test the cart link and checkout
- switch market and repeat
- check quick-add and app-powered drawers separately.

