Skip to main content
This section describes the available actions in the Stores area. With these actions, a store can be selected for the current session or the checkout process, for example.

Actions overview

ActionDescription
SelectStoreSets a store as the active store for the current session.

Actions

SelectStore

With this action, the customer selects a store as their active store for the current session. The selection is applied immediately and is then available, for example, for displaying location-based content or as a preselection in the checkout. Usage example
Useful for a store overview page, for example, where the customer is shown all available stores and can select their desired store with a click, e.g., to view opening hours, availability, or Click & Collect options for their store.
Parameters
NameDescription
storeIdThe ID of the store to be set as the active store.
Error codes
CodeDescription
missingStoreIdParameter storeId is missing.
invalidStoreIdThe specified store ID does not exist or is invalid.
Related modules, variables & methods Example showing how all available stores are displayed as a selection list with the currently selected store preselected.
{{ var $myActionSelectStore = $wsActions.create("SelectStore") }}
<form method="post" action="{{= $wsViews.current.url() }}">
    <input type="hidden" name="wsact" value="{{= $myActionSelectStore.id }}">
    <input type="hidden" name="wscsrf" value="{{= $myActionSelectStore.csrf }}">
    {{ foreach $myStore in $wsStores.loadAllStores() }}
        <label>
            <input type="radio" name="storeId" value="{{= $myStore.id }}"
                {{ if $wsStores.selectedStore and $myStore.id == $wsStores.selectedStore.id }} checked{{ /if }}>
            {{= $myStore.name }}
        </label>
    {{ /foreach }}
    <button type="submit">Select store.</button>
</form>