Skip to Content

Store Context

Use the @storeContext directive to execute a Storefront GraphQL operation in a specific storefront context. This is useful when you need to control the language, country, or currency for the response, or when you want to resolve the operation in an authenticated customer’s context.

Supported arguments

  • language - Language code for the response, for example fi or en
  • country - Country code for the storefront context, for example FI or SE
  • currency - Currency code used in the response, for example EUR or SEK
  • customerAccessToken - Customer access token for authenticated customer context

Example: localized product query

query GetFinnishProducts @storeContext(language: "fi", country: "FI", currency: "EUR") { catalog { products { edges { node { id title price } } } } }

Using customerAccessToken

@storeContext also accepts customerAccessToken. Retrieve the token with the customerAccessTokenCreate mutation, then pass the returned accessToken value into the directive.

mutation CreateCustomerAccessToken { customerAccessTokenCreate(input: { email: "customer@example.com" password: "SecurePassword123" }) { customerAccessToken { accessToken expiresAt } } }
query GetPersonalizedCatalog($customerAccessToken: String!) @storeContext( language: "fi" country: "FI" currency: "EUR" customerAccessToken: $customerAccessToken ) { catalog { products { edges { node { id title price } } } } }