Store specific stock numbers¶
Retailers with both online and physical store channels, so called omnichannel retailers, frequently have a large share of visitors who use the site to explore the product range and discover items to buy, but still prefer making the actual purchase in the store. To cater to that need, Elevate supports supplying store specific stock numbers for variants. This enables visitors to get an experience that is tailored towards their preferred physical stores.
Supply store and stock information¶
Store and stock information is defined for each variant in the data feed. Supply the online stock information in the stock number element, stock_number
, of the variant and the store and store specific stock information in the stores element, stores
, within the variant.
Query parameters¶
To retrieve store specific stock numbers, include the stores
parameter in a query. To control availability calculations, conclude whether the channels
parameter needs to be overridden in the the query. If STORE
is explicitly declared in the channels
parameter, then value(s) for the store
parameter must be supplied with the relevant store keys as added in the data feed.
Invalid queries
When the STORE
value is present in the channels
parameter, the stores
parameter is required and must not be empty. Failing to supply the stores
parameter in this case will result in a HTTP status 400 Bad Request.
Example¶
The following example shows a site with stock levels online and in two physical stores identified by the store keys 240
and 100
. The site has three products that are chainsaws, and each product has one variant.
Data feed¶
The information in the data feed for those products are as follows:
Simplified example data feed
<?xml version="1.0" encoding="UTF-8" ?>
<data_import type="full">
<modify market="US" locale="en-US">
<product_groups>
<add_or_replace>
<product_group key="1001">
...
<products suppress_duplicates="true">
<product key="1001-100">
...
<variants>
<variant key="1001-100-1">
<stock_number>10</stock_number>
...
<stores>
<store key="240">
<stock_number>5</stock_number>
</store>
<store key="100">
<stock_number>0</stock_number>
</store>
</stores>
</variant>
</variants>
</product>
</products>
</product_group>
<product_group key="1002">
...
<products suppress_duplicates="true">
<product key="1002-100">
...
<variants>
<variant key="1002-100-1">
<stock_number>10</stock_number>
...
<stores>
<store key="240">
<stock_number>0</stock_number>
</store>
<store key="100">
<stock_number>0</stock_number>
</store>
</stores>
</variant>
</variants>
</product>
</products>
</product_group>
<product_group key="1003">
...
<products suppress_duplicates="true">
<product key="1003-100">
...
<variants>
<variant key="1003-100-1">
<stock_number>0</stock_number>
...
<stores>
<store key="100">
<stock_number>1</stock_number>
</store>
</stores>
</variant>
</variants>
</product>
</products>
</product_group>
</add_or_replace>
</product_groups>
</modify>
</data_import>
The products and their stock levels can be summarized as following:
Product key | Online stock level | Store stock levels |
---|---|---|
1001-100 | 10 | 240 : 5, 100 : 0 |
1002-100 | 10 | 240 : 0, 100 : 0 |
1003-100 | 0 | 100 : 1 |
Query¶
A query with the search phrase chainsaw
is made to the search-page
endpoint. Included in the query are additional parameters to show stock levels online and from the physical store with the key 240
.
#!/bin/bash
curl -X GET \
'https://{cluster-id}.api.esales.apptus.cloud/api/v2/queries/search-page?market=US&locale=en-US&customerKey=b65f78d4-23f0-4043-bd5e-fea24b5837d3&sessionKey=cc6772fd-65e2-4392-a1ee-24977c99fd2e&touchpoint=desktop&limit=60&skip=0&viewId=production&q=chainsaw&channels=ONLINE|STORE&stores=240'
const api = esales({ clusterId: 'w00000000', market: 'US', locale: 'en-US', touchpoint: 'desktop' });
const results = await api.query.searchPage({
q: 'chainsaw',
channels: 'ONLINE|STORE',
stores:'240'
});
Result¶
As the query includes both results from online and a specific physical store, 240
, the result will only display two of the three products matching the search phrase chainsaw
as the third product, 1003-100
, has no stock level online or in the selected store.
Simplified example result
{
"q": "chainsaw"
},
"primaryList": {
"productGroups": [
{
"products": [
{
"key": "1001-100",
...
"inStock": true,
...
"variants": [
{
"key": "1001-100-1",
...
"inStock": true,
"stockNumber": 10,
...
"availability": [
{
"key": "240",
"channel": "STORE",
"stockNumber": 5
},
{
"key": "100",
"channel": "STORE",
"stockNumber": 0
}
],
...
]
}
],
...
}
],
"key": "1001"
},
{
"products": [
{
"key": "1002-100",
...
"inStock": true,
...
"variants": [
{
"key": "1002-100-1",
...
"inStock": true,
"stockNumber": 10,
...
"availability": [
{
"key": "240",
"channel": "STORE",
"stockNumber": 0
},
{
"key": "100",
"channel": "STORE",
"stockNumber": 0
}
],
...
}
],
...
}
],
"key": "1002"
},
{
"products": [
{
"key": "1003-100",
...
"inStock": false,
...
"variants": [
{
"key": "1003-100-1",
...
"inStock": false,
"stockNumber": 0,
...
"availability": [
{
"key": "100",
"channel": "STORE",
"stockNumber": 0
}
],
...
}
],
...
}
],
"key": "1003"
}
],
"totalHits": 3,
...
"sort": {
"selected": "RELEVANCE",
"options": [
{
"id": "RELEVANCE",
"label": "Relevance"
}
]
}
},
...
}
The effects of the parameter combinations for this query is shown below:
Channels | Stores | Displayed when filtering | 1001-100 result | 1002-100 result | 1003-100 result |
---|---|---|---|---|---|
ONLINE|STORE | 240 | 1001-100 , 1002-100 | inStock : truestockNumber : 15availability : online: 10, store 240 : 5 | inStock : truestockNumber : 10availability : online: 10, store 240 : 0 | inStock : falsestockNumber : 0availability : online: 0 |
For more information about the parameters, and how parameter combinations effects pages, see Stores and channels.