Feat [Shopify]: Internationalization Support for Shopify Loaders and Queries #1100
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What is this Contribution About?
This PR introduces internationalization (i18n) support for the main Shopify queries and loaders used in Deco.cx. With this update, it's now possible to dynamically pass
languageCode
andcountryCode
values via the@inContext
directive, allowing the Shopify Storefront API to return localized content for different languages and regions.🧩 How It Works
✅ Loaders
Most loaders now accept the following optional props:
These values are passed as variables to GraphQL queries and injected using the
@inContext
directive.✅ Queries
All core Shopify queries have been refactored to use GraphQL variables in the
@inContext
directive (instead of interpolated JavaScript), making them fully compatible with GraphQL tooling and static code analysis like GraphQL Codegen.Example:
On the TypeScript side, the variables are passed like this:
🛠 Affected Queries
This pattern has been applied consistently across the following queries:
ListProducts
SearchProducts
ProductsByCollection
ProductRecommendations
GetProduct
(and related queries)Shop
Cart
These changes improve maintainability, tooling support (e.g., GraphQL Codegen), and ensure proper localization behavior across storefront queries.
🌍 Impact
inContext
across queries and loaders.Loom Video
https://www.loom.com/share/8a8f204de9a745528ac2f84f44f428fa