Skip to main content

Store Context

Every storefront API request operates within a store context that determines which store, language, and currency to use. This context is resolved from HTTP headers.

How It Works​

The IStoreContext service is injected into every controller and service. It provides:

  • Current Store — determines product visibility (store mappings), warehouse assignments, payment/shipping methods
  • Current Language — determines which localized text is returned for product names, descriptions, categories, etc.
  • Current Currency — determines which price is returned for product variants

Required Headers​

HeaderExampleFallback
X-Store-Codeus-storeFirst store in database
X-Language-CodeenStore's default language
X-Currency-CodeUSDStore's default currency

Store Configuration Endpoint​

Before making any other calls, fetch the store configuration to discover available options:

GET /api/storefront/store-config
X-Store-Code: us-store

Response:

{
"store": {
"id": "guid",
"name": "US Store",
"code": "us-store",
"url": "https://us.example.com"
},
"languages": [
{ "id": "guid", "code": "en", "name": "English", "isDefault": true },
{ "id": "guid", "code": "tr", "name": "Turkish", "isDefault": false }
],
"currencies": [
{ "id": "guid", "code": "USD", "symbol": "$", "isDefault": true },
{ "id": "guid", "code": "TRY", "symbol": "₺", "isDefault": false }
]
}

Multi-Store Product Visibility​

Products can be limited to specific stores via Store Mappings. When Product.LimitedToStores is true, only stores with an explicit mapping can see the product.

Products with LimitedToStores=false are visible to all stores.

Impact on API Responses​

FeatureAffected By
Product names, descriptionsX-Language-Code
Category namesX-Language-Code
Attribute/value namesX-Language-Code
Brand namesX-Language-Code
Variant pricesX-Currency-Code
Product visibilityX-Store-Code (store mappings)
Available warehousesX-Store-Code (store-warehouse links)
Payment methodsX-Store-Code
Shipping methodsX-Store-Code
Navigation menusX-Store-Code

Implementation Notes​

For Mobile Apps

If your app supports multiple stores, present a store selector first, then set the X-Store-Code header for all subsequent requests. The store code is a stable string identifier that doesn't change.

Caching

Storefront GET responses include Cache-Control headers (300s by default) and vary by X-Store-Code, X-Language-Code, and X-Currency-Code. Your HTTP client can leverage this for efficient caching.