> ## Documentation Index
> Fetch the complete documentation index at: https://dokumentation.websale.de/llms.txt
> Use this file to discover all available pages before exploring further.

# Stores

> Reference for WEBSALE store actions: select a store for the current session or checkout to support click & collect and store-based availability.

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

| **Action**    | **Description**                                           |
| ------------- | --------------------------------------------------------- |
| `SelectStore` | Sets 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**

| **Name**  | **Description**                                    |
| --------- | -------------------------------------------------- |
| `storeId` | The ID of the store to be set as the active store. |

**Error codes**

| **Code**         | **Description**                                      |
| ---------------- | ---------------------------------------------------- |
| `missingStoreId` | Parameter `storeId` is missing.                      |
| `invalidStoreId` | The specified store ID does not exist or is invalid. |

**Related modules, variables & methods**

* [\$wsStores](/en/frontend/referenz/module/wsstores)
* [\$wsStores.loadAllStores()](/en/frontend/referenz/module/wsstores#\$wsstores-loadallstores)
* [\$wsStores.selectedStore](/en/frontend/referenz/module/wsstores#\$wsstores-selectedstore)

**Example** showing how all available stores are displayed as a selection list with the currently selected store preselected.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{{ 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>
```
