`theme dev` can't render market subfolder URLs on stores with a custom primary domain

Summary

On a store whose markets use subfolders on a custom primary domain, shopify theme dev can’t render those market URLs. Default-language subfolders return 404. Other languages return 200, but merchant content stays in the default language. The same theme renders all of these URLs correctly when previewed on the primary domain.

Environment

  • Shopify CLI: 5.0.1 (latest at time of writing)
  • OS: macOS 27.2 (arm64)
  • Node: 24.15.0
  • Shell: zsh

Store setup

  • Custom primary domain (example.com below). your-store.myshopify.com redirects to it.
  • Live URLs are all subfolders: /en-us, /es-us, /en-ca, /fr-ca. The root / redirects to /en-us.
  • Markets: US and Canada.
  • Languages: en (default), fr, es.

Steps to reproduce

  1. Run shopify theme dev -s your-store -t your-theme.
  2. Open /en-us, /en-ca, /es-us, and /fr-ca on http://127.0.0.1:9292.
  3. Open the same paths on the primary domain with the same theme, e.g. https://example.com/fr-ca?preview_theme_id=<dev theme id>.

Expected behavior

Market URLs render locally the same way they do on the primary domain, with the right language, market, and root path.

Actual behavior

Path theme dev Primary domain, same theme previewed
/en-us 404 200, Shopify.routes.root is /en-us/
/en-ca 404 200, Shopify.routes.root is /en-ca/
/es-us 200, Shopify.locale is es-US, Shopify.routes.root is /es/, merchant content in English 200, Shopify.locale is es, Shopify.routes.root is /es-us/, translated
/fr-ca 200, Shopify.locale is fr-CA, Shopify.routes.root is /fr/, merchant content in English 200, Shopify.locale is fr, Shopify.routes.root is /fr-ca/, translated

Other behavior on the local server:

  • Any fr-XX or es-XX prefix returns 200, including /fr-be and /es-mx, and the suffix is copied into Shopify.locale. Any en-XX prefix returns 404.
  • Theme strings on these pages do come from fr.json and es.json, so the page is partly translated. Content translated in Shopify is not.
  • Links on /fr-ca point to /fr/..., so navigating leaves the market URL. /fr itself is a 404 on the primary domain.
  • /?country=CA redirects to /en-ca, which then returns a 404.

Reproduction without the CLI

These requests reproduce the same behavior against the published theme, with no dev server running:

curl -s -o /dev/null -w '%{http_code} %{redirect_url}\n' 'https://your-store.myshopify.com/fr-ca'
# 301 https://example.com/fr-ca

curl -s -o /dev/null -w '%{http_code} %{redirect_url}\n' 'https://your-store.myshopify.com/fr-ca?pb=0'
# 301 https://example.com/fr-ca?pb=0

curl -s -o /dev/null -w '%{http_code} %{redirect_url}\n' 'https://your-store.myshopify.com/fr-ca?_fd=0'
# 200

curl -s -o /dev/null -w '%{http_code} %{redirect_url}\n' 'https://your-store.myshopify.com/en-ca?_fd=0&pb=0'
# 404

Hi @Roman I checked the current storefront code. Your direct-request results match a limitation with resolving market subfolders on a non-primary domain.

On the myshopify-domain path, /fr-ca is treated as the locale fr-CA, and generated links use /fr/. Default-language prefixes can fail validation, consistent with your /en-* 404s. Theme strings can still fall back to fr.json, while merchant-content lookups can miss translations stored under fr when the request locale remains fr-CA.

The earlier Theme ID Mismatch update covered preserving the preview theme through redirects and explicitly excluded custom-domain redirects. That fix didn’t change this locale handling.

The primary-domain preview you’ve already tested is a working workaround. Keep theme dev running to sync changes, then refresh that preview once syncing finishes. It won’t have the local preview’s hot reload.

Thanks for looking into this.
The primary-domain preview works for manual checks, but it doesn’t replace local development for us. Besides losing hot reload, it moves testing to the public domain, where requests are often blocked from tools like Cypress and playwright-cli. We’ve also seen 429 responses on product and collection pages from scripted requests. So we can’t reliably run automated tests against market URLs, and theme dev, which those tools can reach, can’t render them.

Is a fix planned for this? The Theme ID Mismatch said work on custom domains would continue. Does that work cover market subfolders?

Thanks @Roman. I’ve logged your request for market subfolders to work in local theme development with hot reload, including the impact on automated testing.

For the blocked requests on your custom domain, have you tried Crawler access signatures? They’re supported for automated storefront testing:
https://help.shopify.com/en/manual/promoting-marketing/seo/crawling-your-store

If signed requests still get blocked, please contact Partner Support and include this thread and an example failed request so we can investigate:
https://help.shopify.com/en/partners/help-support/getting-support