Docs
Dashboard

Storefront request context

Last updated View as Markdown

Storefront request context

A Storefront response depends on where and for whom the buyer is shopping. Keep that context together in your application so product pages, the cart, and checkout do not silently use different prices or eligibility.

Context values

ValueResponsibility
storeIdConfigured store and its channel relationships
priceChannelIdIntended price channel
priceCurrency and priceCountryCatalog price selection
localeSupported localized content
Customer access tokenAuthenticated buyer context

Cart inputs use currency and countryCode where the corresponding catalog arguments use priceCurrency and priceCountry. Read the exact operation input instead of copying argument names between APIs.

Resolve one supported market

Keep a server-controlled mapping from storefront market routes to allowed store, channel, country, and currency values. A browser can select a supported market, but should not supply arbitrary configuration IDs that your server blindly forwards. The Next.js example centralizes market configuration and request context.

Carry context into the cart

Create the cart with the same commercial values used for product discovery. An existing cart retains its own context. Changing only the route or displayed currency does not update it. Use the supported cart update or replication workflow when appropriate, or create a replacement cart deliberately and preserve the buyer’s choices.

After sign-in or sign-out, refresh customer-sensitive data and reconcile the cart. Do not continue checkout from an anonymous price cached before the identity change.

Cache boundaries

A shared catalog cache key must include all values that change its response, including market, locale, filters, sort, and pagination. Keep customer, cart, and account responses out of public shared caches. Discard cursors when the query or context changes.

See Build product pages and Build a cart and checkout for implementation.