Skip to main content
With the $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
JSON output
Note: ƒ() denotes a function. Variables and methods overview

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. Is null if no store has been selected.

Methods

$wsStores.loadAllStores()

Loads a list of all available stores. Signature
$wsStores.loadAllStores()
Return value
array - 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 value
map - 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

Actions

No actions are available for $wsStores.

Examples

List all stores

Example that displays all stores with address and opening status:

Display store selection as a dropdown

Example that provides a store selection as a dropdown:

Click & Collect in checkout

Example that only displays stores with Click & Collect for pickup:

Check stock in the store

Example that checks the stock of a product in a specific store: