As of Storefront API version 2026-10, the directive accepts an optional argument. Use to apply a specific sales channel’s context to an entire query, including channel-specific product availability and pricing.
Example:
query Product($handle: String!, $channelId: ID!)
@inContext(channelId: $channelId) {
product(handle: $handle) {
id
title
availableForSale
priceRange {
minVariantPrice {
amount
currencyCode
}
}
}
}
query Product($handle: String!, $channelId: ID!)
@inContext(channelId: $channelId) {
product(handle: $handle) {
id
title
availableForSale
priceRange {
minVariantPrice {
amount
currencyCode
}
}
}
}
Why it's changing
The existing directive lets you set buyer context such as country and language. With , you can now:
- Target a specific channel (for example, a marketplace or custom sales channel) when fetching products, prices, and availability.
- Build channel-aware storefronts that show the correct catalog, pricing, and merchandising rules for each channel.
- Reduce custom logic in your app by relying on the API to apply channel-specific behavior.
Requirements
Access requirement: You can only pass the ID of a channel created by the API client making the request.
Fallback behavior: If you omit , the Storefront API uses the first channel owned by that API client. Pass explicitly when your app owns multiple channels or needs to select a specific channel.
Learn more about contextual queries.
Was this page helpful?