/weaverse:hydrogen-markets-localizationfrom weaverse
Implements or reviews Shopify Hydrogen market localization including locale routes, translations, hreflang, RTL, and localized cart/account/checkout behavior with Weaverse.
Ships in weaverse. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Implement or review market localization as one end-to-end contract. A locale switch is incomplete until routing, Shopify context, Weaverse content, document metadata, navigation, commerce, accounts, SEO, and production configuration agree.
Run these from this skill's own folder. The helpers ship inside the sibling
shopify-hydrogen skill, so ../shopify-hydrogen/scripts/ exists whenever the
whole pack is installed.
If you installed this skill on its own, that folder is absent and the commands
below fail with MODULE_NOT_FOUND. Add the helpers once:
npx skills add Weaverse/shopify-hydrogen-skills --skill shopify-hydrogen
The references/ files in this skill remain a usable offline fallback if you
would rather not install it.
Check current contracts before changing framework or platform behavior:
node ../shopify-hydrogen/scripts/search_shopify_docs.mjs "Hydrogen localization Shopify Markets i18n country language"
node ../shopify-hydrogen/scripts/search_shopify_docs.mjs "Hydrogen Customer Account logout postLogoutRedirectUri"
node ../shopify-hydrogen/scripts/search_shopify_docs.mjs "Hydrogen SEO canonical hreflang sitemap"
node ../shopify-hydrogen/scripts/search_weaverse_docs.mjs "localization Translation Manager locale"
Use repository references only as an offline fallback. Never infer current Shopify or Weaverse APIs from examples in this skill.
xx-yy, but preserve ordinary first-segment slugs.On Hydrogen 2026.10 there is no createHydrogenContext: server.ts and app/.server/context.ts build the request context, so the market flows through code you own. Pilot main is the reference; trace the same seams in any storefront:
| Seam | Pilot implementation |
|---|---|
| Market list and path helpers | SUPPORTED_LOCALES, DEFAULT_LOCALE, resolveLocale, localizePath, delocalizePath, isUnsupportedMarketPath, providerLanguageFor in app/utils/locale.ts |
| Hydrogen locale definition | export const i18n = defineShopifyI18n({ defaultLocale, routing: { type: "pathname", locales } }) in app/utils/locale.ts (@shopify/hydrogen 2026.10.3), built from SUPPORTED_LOCALES: each entry carries Shopify's provider language and pins its existing prefix as pathSegment, so URLs don't change. It replaces the deprecated fixed i18n object and I18nConfig |
| Request market | resolveRequestLocale(request) in app/.server/storefront.ts: the path prefix for page requests; for the unprefixed Hydrogen handler paths (/api/*, /account/login|logout|refresh) the same-origin Referer, and return_to for /account/login; else the default market |
| Shopify context | createRequestStorefront() calls createShopifyRequestContext({ request, i18n, locale }) with the request market in Shopify's provider language (e.g. ZH_TW); loaders read it as storefront.locale (storefront.i18n is deprecated), and storefront.graphql() fills $country/$language from it, so never pass them in variables |
| Weaverse context | new WeaverseClient({ storefront, locale: resolveRequestLocale(request), ... }) in app/.server/context.ts. The locale option (@weaverse/hydrogen 6.1+, { language, country, pathPrefix }) carries the public market for Translation Manager, page requests and Studio's requestInfo.i18n, while the storefront client keeps the provider language. Without it Weaverse reads storefront.locale |
| Unsupported prefixes | app/routes.ts wraps :locale? pages in the routes/market-guard.ts layout (loader throws 404, rendered by the root ErrorBoundary) and resource routes in routes/market-guard-resources.ts (middleware 404) |
| Redirects | On a 404, server.ts calls marketAwareRedirect() (app/.server/market-redirect.ts) around handleShopifyRedirects(): delocalizes the lookup, relocalizes the target, and answers single-fetch .data navigations; it skips unsupported markets |
| Cart country | Pilot's POST /api/cart handler runs syncCartCountry() before delegating to Hydrogen's cart handler; the country selector posts to POST /api/cart/buyer-identity; /cart/checkout syncs again before redirecting (app/.server/cart.ts, app/routes/cart/checkout.tsx) |
| Customer Account | Login links carry return_to (localized) and locale; every sign-out uses one fixed postLogoutRedirectUri, /account/signed-out: the logout remembers the market's prefix in the session and /account/signed-out redirects to that market's home. Shopify only returns to registered logout URIs, so stores register <origin>/account/signed-out once instead of one URI per market (app/utils/customer-account.ts, app/.server/customer-account.ts) |
| Shopify scripts | <ShopifyScripts i18n={...}> is built per market in the root loader; after a client-side market switch syncShopifyMarket() (app/utils/shopify.ts) updates window.Shopify country, currency, locale and routes.root |
Map the complete request path and every consumer of locale state:
defineShopifyI18n definition, and the request-scoped Storefront client's locale built in app/.server/context.ts.WeaverseClient locale option versus storefront.locale, and any loadPage({ locale }) overrides.<html lang> and <html dir>.handleShopifyRedirects lookups, and .data routes./api/cart mutations, buyer identity, country selector, permalinks, and checkout redirect.return_to, locale), unauthorized redirect, and logout URI.<ShopifyScripts> i18n and the client-side window.Shopify market sync.Run caller/reference sweeps before removing old routes, settings, helpers, aliases, or translation readers. Remove a legacy path only after the canonical path covers every caller.
Use one immutable configuration consumed by routing, context creation, selectors, SEO, and tests. Require exactly one default market with an empty prefix; normalize other prefixes consistently. Model RTL explicitly instead of deriving direction ad hoc in components.
Keep public locale identity separate from provider identity when evidence requires it. Shopify may require a provider language enum while Weaverse translation lookup requires the public language-country key. Pass each boundary the identity it actually consumes; do not mutate one shared object until both happen to work.
Make path helpers idempotent and segment-aware. Handle React Router data-route suffixes without treating them as part of the locale. Preserve query strings where the user flow requires them.
To add one market, change the canonical allowlist first, then prove every derived consumer updates without a second market table. Add a translation bundle only for a language or script not already covered. A second manual locale edit is evidence to consolidate configuration, not a normal rollout step.
lang and dir from the same resolved market./api/cart handler (wrap it with an app handler registered first), cart permalinks, and the checkout hand-off.Referer (and return_to for login), never from a prefix they don't have./. Reject schemes, protocol-relative forms, backslashes, control characters, and parse failures; fall back to the localized cart route./account/signed-out, then a redirect to the remembered market's home) over one logout URI per market. Read back the current Customer Account API configuration, and require explicit owner approval before registering or changing URIs.Build one canonical URL for the current market and prevent CMS metadata from adding a second. Generate hreflang only from an explicit equivalence rule: invariant routes may qualify; localized handles, unpublished resources, and uncertain CMS pages do not. Render-check the framework's x-default form instead of assuming a helper flag produces valid markup. Do not fabricate sitemap alternates to make coverage look complete.
Verify the actual readers and tests, then enforce this precedence where each source exists:
Resolve each source by these rules:
For every configured market, probe the production Shopify boundary and read back the effective country, language, and currency. Fail the release when Shopify silently falls back. Also verify:
<origin>/account/signed-out in Pilot, or every localized one) is registered.Keep production proof read-only by default. Before changing Shopify, Customer Account, Weaverse, cart, session, or checkout state, confirm the exact environment, identity, scope, and values and obtain explicit owner approval. Use dedicated test identities and never place a paid order for localization verification.
The Weaverse Shopify Admin API proxy is a scoped authority bridge. Verify its current mounted route before use; the Builder implementation exposes:
POST https://studio.weaverse.io/api/admin-graphql with a GraphQL query or mutation and variables.Authorization: Bearer <WEAVERSE_API_KEY> using a shop-scoped token of type shopify or content_api; agent_cli tokens are rejected.This is real Shopify Admin access, but not unqualified access to every Shopify resource. Request the minimum scopes required for the verified operation. Storefront API access proves effective storefront behavior but does not replace Admin authority.
Execute in this order:
WEAVERSE_API_KEY in an untracked server-only environment file with mode 0600, or use an approved credential binding. Never put it in client code, prompts, documentation, URLs, command arguments, or logs.errors, and mutation payload userErrors; any one means the write is not proven. Stop on drift, fallback, partial failure, or an unexpected response.lang/dir, locale-preserving navigation, cart buyer identity, checkout market/currency, canonical/hreflang, sitemap policy, Translation Manager output, and deployed revision. Redact sensitive URL/query/session values from evidence.If the key, minimum Shopify scopes, or a verified mutation is unavailable, finish all reachable code and read-only checks, mark the corresponding production setup unproven, and produce the exact admin handoff in the verification checklist. Never claim the market is enabled or end-to-end localization succeeded.
Read references/verification-checklist.md and execute only the checks applicable to the storefront. Start with focused regressions, then exercise the real dev server and production boundaries. Keep market lists and expected currencies merchant-specific.
shopify-hydrogen for current Hydrogen context, cart, SEO, and sitemap APIs.weaverse-hydrogen for Weaverse client and page-loading APIs.weaverse-content-api for authenticated per-locale content reads and writes; do not reproduce that API workflow here.generating-weaverse-project-json when import-time defaultLocale or page assignments must change.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub weaverse/shopify-hydrogen-skills --plugin weaverse14 skills in this plugin
/cloning-websites-to-weaverseUse when recreating a reference website or brand hub in this Hydrogen plus Weaverse repo, especially when deciding whether to reuse sections, add global styles, update theme schema, or resolve conflicts between the live site and project brand guidelines./figma-to-weaverseUse when recreating a Figma design as Hydrogen + Weaverse pages in this repo — turning a Figma file, frame, or flow into reusable Weaverse sections. Triggers on a figma.com URL, "build this design", "implement this Figma", or "create the storefront from the design". The Figma counterpart of cloning-websites-to-weaverse./generating-weaverse-project-jsonUse when generating Weaverse project export JSON for import into the Weaverse editor. Triggers on requests to create, build, or produce a Weaverse project JSON file from a site migration, design spec, page layout description, or existing export. Also use when converting section plans into importable project and pages data./hydrogen-analytics-trackingEnd-to-end analytics & conversion tracking on Shopify Hydrogen — GTM, GA4 (browser + Measurement Protocol), Meta Pixel + CAPI, Google Ads, consent mode, CSP, Oxygen full-page cache. Real-world patterns from production deployments./hydrogen-cookbooksStep-by-step implementation guides for building features in a Shopify Hydrogen 2026.10 + Weaverse storefront (Pilot) — bundles, combined listings, customer accounts, 3D models, performance, variant media, and Weaverse integration./hydrogen-upgradesStep-by-step guides for upgrading Shopify Hydrogen between versions — breaking changes, code diffs, and migration steps for each release.Other plugins' skills for the same job