# Show local prices and languages with @inContext

> Get prices in the buyer’s currency and content in their language from the Storefront API by adding @inContext(country, language) to the query.

Page: https://lintelagency.com/resources/graphql/storefront-local-prices-in-context

## In short

To show local prices in a headless storefront, add the @inContext directive to the query with the buyer’s country (and language), for example @inContext(country: CH, language: DE). Prices then come back in that market’s currency, and products not published in that market are left out. Without the directive, you get the primary market’s products and prices in the store currency.

## Facts

- **API:** Storefront API
- **Operations:** @inContext directive, product, localization
- **Access scope:** unauthenticated_read_product_listings
- **API version:** 2026-10
- **Last checked:** 2 November 2026

## How to use it

1. Detect the buyer’s country (from the URL, a selector or geolocation) and the language.
2. Pass them as variables to LocalProductPrices; the directive sits on the operation, after the variable list.
3. Read localization.country.currency to format prices and build the country selector.
4. Use the same country as buyerIdentity.countryCode on the cart so cart prices match.

## Code

### product-prices-in-context.graphql

```graphql
query LocalProductPrices($handle: String!, $country: CountryCode!, $language: LanguageCode!)
@inContext(country: $country, language: $language) {
  localization {
    country {
      isoCode
      currency {
        isoCode
        symbol
      }
    }
    language {
      isoCode
    }
  }
  product(handle: $handle) {
    title
    priceRange {
      minVariantPrice {
        amount
        currencyCode
      }
    }
    variants(first: 10) {
      nodes {
        id
        title
        price {
          amount
          currencyCode
        }
        compareAtPrice {
          amount
          currencyCode
        }
      }
    }
  }
}
```

### product-prices-in-context.variables.json

```json
{
  "handle": "linen-shirt",
  "country": "CH",
  "language": "DE"
}
```

### product-prices-in-context.response.json

```json
{
  "data": {
    "localization": {
      "country": {
        "isoCode": "CH",
        "currency": {
          "isoCode": "CHF",
          "symbol": "CHF"
        }
      },
      "language": {
        "isoCode": "DE"
      }
    },
    "product": {
      "title": "Leinenhemd",
      "priceRange": {
        "minVariantPrice": {
          "amount": "49.0",
          "currencyCode": "CHF"
        }
      },
      "variants": {
        "nodes": [
          {
            "id": "gid://shopify/ProductVariant/1111111111",
            "title": "S",
            "price": {"amount": "49.0", "currencyCode": "CHF"},
            "compareAtPrice": null
          }
        ]
      }
    }
  }
}
```

## Limits and edge cases

- The country’s currency must be enabled in the store’s payment settings, and the country must belong to an active market.
- Queries use @inContext; carts store the context in buyerIdentity instead.
- Orders keep the currency they were placed in, whatever context you query them in.
- In Hydrogen, storefront.query fills $country and $language from the i18n settings; you still write the @inContext directive in the query.

## Questions

### How do I get prices in another currency with the Storefront API?

Add @inContext(country: XX) to the query. Prices come back in the currency of the market that country belongs to.

### Why does @inContext still return the store currency?

The country probably isn’t in an active market with its own currency, or that currency isn’t enabled in the store’s payment settings.

### Does @inContext also translate content?

Yes, with the language argument. Product titles and descriptions come back in that language where translations exist.

## Shopify documentation

- [Support international pricing on storefronts](https://shopify.dev/docs/storefronts/headless/building-with-the-storefront-api/markets/international-pricing)
- [Storefront API product query](https://shopify.dev/docs/api/storefront/latest/queries/product)

## Related

- [Selling in many currencies from one Shopify store](https://lintelagency.com/journal/shopify-markets-multi-currency)
- [Create a cart and add items with the Storefront API](https://lintelagency.com/resources/graphql/storefront-cart-create-and-add)
- [Translate content, also per market](https://lintelagency.com/resources/graphql/translations-register)

License: MIT. Free to use in your own store and in client work.
