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
| Header | Example | Fallback |
|---|---|---|
X-Store-Code | us-store | First store in database |
X-Language-Code | en | Store's default language |
X-Currency-Code | USD | Store'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
| Feature | Affected By |
|---|---|
| Product names, descriptions | X-Language-Code |
| Category names | X-Language-Code |
| Attribute/value names | X-Language-Code |
| Brand names | X-Language-Code |
| Variant prices | X-Currency-Code |
| Product visibility | X-Store-Code (store mappings) |
| Available warehouses | X-Store-Code (store-warehouse links) |
| Payment methods | X-Store-Code |
| Shipping methods | X-Store-Code |
| Navigation menus | X-Store-Code |
Implementation Notes
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.
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.