$wsStores module, you can access the shop’s configured stores and branches. Typical use cases are Click & Collect, store finder, and the display of stock levels in the store. In this section, you will learn how to load stores, manage the selected store, and display opening hours.
Module overview
Example / excerpt of$wsStores
ƒ() denotes a function.
Variables and methods overview
| Name | Return type | Description |
|---|---|---|
selectedStore | map | Currently selected store, or null if none is selected. |
loadAllStores() | array | Loads a list of all available stores. |
loadStore() | map | Loads a single store by its ID. |
Templates
The $wsStores module is typically used on:- Store search pages (store finder)
- Product detail pages (availability in the store)
- Checkout pages (Click & Collect selection)
- Header/footer (display of the selected store)
Variables
$wsStores.selectedStore
Returns the store currently selected in the session. Isnull if no store has been selected.
Methods
$wsStores.loadAllStores()
Loads a list of all available stores. Signature$wsStores.loadAllStores()
Return valuearray - List of store maps.
Example that loads and displays all stores.
$wsStores.loadStore()
Loads a single store by its ID. Signature$wsStores.loadStore(storeId)
Return valuemap - Store map with all store data.
Example that loads a store.
By using the return data of
$wsStores.loadStore, various properties are available that can be used. Below is an overview of which properties are available.Properties of $wsStores.loadStore| Property | Return type | Description |
|---|---|---|
id | int | Unique ID of the store. |
name | string | Name of the store. |
street | string | Street (incl. house number if applicable). |
zipCode | string | Zip code. |
city | string | City. |
country | string | Country. |
storageId | string | ID of the store warehouse for querying stock via $wsInventory.load(). |
clickAndCollect | bool | Availability of Click & Collect. |
openNow | bool | Check whether the store is currently open. |
location | map | GPS coordinates (latitude, longitude) |
latitude | float | Latitude. |
longitude | float | Longitude. |
openingHours | map | Opening hours by day of the week (0-6). |
0-6 | array | Opening hours per weekday (0=Sunday, 1=Monday, …, 6=Saturday). |
specialDays | array | Days with deviating opening hours (e.g. public holidays). |
month | int | Month (1-12). |
day | int | Day (1-31). |
times | array | Opening hours for this day. |
startTime | map | Start time with hours and minutes. |
endTime | map | End time with hours and minutes. |
zipPrefix | array | Zip code prefixes assigned to this store (for automatic store suggestions based on the customer’s address). |
allowedSubshop | array | List of subshop IDs in which this store is available. |
Actions
No actions are available for$wsStores.
