> ## 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.

# basket - Basket

> Configure the basket node: shopping basket behaviour, automatic add-on products (autobasket), basket cookies and persistence in the WEBSALE online shop.

export const KonfigDeeplink = ({node}) => <>
    You can open this setting directly in the Admin Interface via the following link:{" "}
    <code>{`https://<shop-domain>/admin/config/${node}`}</code>{" "}
    (<a href="/en/admin-interface/konfigurations-deeplinks">Deeplink overview</a>)
  </>;

The `basket` section covers all settings around the shopping basket of the online shop.\
This is where you control how the basket behaves, which items are automatically added and how long basket data is stored.

Typical configuration options include:

* **Automatic add-ons** — defines products that are automatically placed in the basket when the shop is first loaded (e.g. surprise products).
* **Basket cookies** — defines whether a cookie-based basket is active, how long it is stored and how the system behaves when a user returns.
* **General basket options** — for example, the maximum number of items, behaviour on price changes or synchronisation between sessions.

***

## `basket*` - Basic structure

The basic structure of the `basket` node is shown below:

```json theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{
"basket": {
  "autobasket": { ... },
  "basket": { ... }
 }
}
```

#### Parameter description

| **Parameter** | **Description**                                                                                                                |
| ------------- | ------------------------------------------------------------------------------------------------------------------------------ |
| `autobasket`  | Automatically added basket positions. <br />Contains a list of entries per country / shop.                                     |
| `basket`      | Basic basket behaviour: persistence via account/cookie, validity period, behaviour on sign-in/sign-out, maximum item quantity. |

***

## `basket.basket` - Basket settings

The `basket` node controls the basic behaviour of the basket in the shop.

It defines whether baskets are stored per user, how long cookies are valid, and how the basket reacts on sign-in or sign-out.

These settings therefore determine how durably a basket is preserved and how the system behaves for returning users.

Typical use cases:

* Activation of a persistent basket via customer account or cookie
* Definition of the validity period of stored baskets
* Control of whether a basket is deleted or kept on sign-out
* Limitation of the maximum item quantity in the basket

<KonfigDeeplink node="basket.basket" />

#### Example configuration for all subshops (`basket.basket`)

```json theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{
  "accountBasketActive": true,
  "accountBasketDurationDays": 365,
  "clearBasketOnLogout": false,
  "cookieBasketActive": false,
  "cookieBasketDurationDays": 30,
  "maxItemQuantity": 100,
  "readCookieBasketAfterLogin": false
}
```

#### Parameter description

| **Parameter**                | **Type** | **Description**                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| ---------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `accountBasketActive`        | bool     | Controls whether the basket most recently stored for the user account is automatically restored on sign-in.   <br />Without this option, the currently used basket is still preserved locally after sign-out (e.g. via session/cookie).  <br />- `true` — on the next sign-in, the account-bound basket most recently stored is loaded server-side. <br />- `false` — no server-side restoration takes place; only local persistence remains active.  Default: **false** |
| `accountBasketDurationDays`  | int      | Validity period of a stored account basket in days. After expiration the basket is automatically deleted.  <br />Default: **365**                                                                                                                                                                                                                                                                                                                                        |
| `clearBasketOnLogout`        | bool     | Determines whether the basket is deleted on sign-out (`true`) or preserved (`false`).      <br />Default: **false**                                                                                                                                                                                                                                                                                                                                                      |
| `cookieBasketActive`         | bool     | Enables the cookie-based basket. If the value is true, the basket is stored via a browser cookie even without sign-in.  <br />Account basket and cookie basket can exist in parallel. When signed in, the account basket is usually prioritised.  <br />By combining `cookieBasketActive` and `accountBasketActive`, a seamless basket preservation across devices can be achieved.  <br />Default: **false**                                                            |
| `cookieBasketDurationDays`   | int      | Validity period of the cookie basket in days. After expiration the cookie basket is deleted.  <br />Default: **30**                                                                                                                                                                                                                                                                                                                                                      |
| `maxItemQuantity`            | float    | Defines the maximum number of individual items that may be placed in the basket. Used to limit excessively large baskets.  <br />Default: **100.0**                                                                                                                                                                                                                                                                                                                      |
| `readCookieBasketAfterLogin` | bool     | Controls whether an existing cookie basket is read out and merged with the account basket after sign-in (`true`), or whether it is ignored (`false`).  <br />Default: **false**                                                                                                                                                                                                                                                                                          |

***

## `basket.autobasket` - Automatic basket add-ons

With `autobasket` you can place items automatically into the basket — for example gift items or promo products. Multiple automatic items are possible; the order corresponds to the configuration.

Without conditions, the positions are always added; with optional conditions you can control the automatic add-on (e.g. per subshop, country, campaign).

<KonfigDeeplink node="basket.autobasket" />

#### Example configuration for all subshops (`basket.autobasket`)

```json theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
 {
    "products": [
      {
        "product": {
          "id": "GIFT-001",
          "variant": "std",
          "number": "900001"
        },
        "behavior": {
          "product": true,
          "removable": true,
          "changeable": false
        }
      },
      {
        "product": {
          "id": "DEPOSIT-250",
          "number": "990250"
        },
        "conditions": [
          { "field": "country", "value": "DE" }
        ],
        "behavior": {
          "product": true,
          "removable": false,
          "changeable": false
        }
      }
    ]
}
```

#### Parameter description

| **Parameter** | **Type**      | **Description**                                                                                                                   |
| ------------- | ------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| `products`    | list (object) | List of products to be added to the basket.                                                                                       |
| `product`     | object        | Each entry describes **one** item including identification, optional conditions and behaviour.                                    |
| `id`          | string        | Internal/technical item ID.                                                                                                       |
| `variant`     | string        | Variant identifier (if required), e.g. size/colour.                                                                               |
| `number`      | string        | Item number (SKU).                                                                                                                |
| `conditions`  | list (object) | List of conditions; **all** must be satisfied for the add-on to be added.                                                         |
| `field`       | string        | Check field (e.g. `country`, `subshop`, `campaign`).                                                                              |
| `value`       | string        | Expected value (e.g. `DE`, `deutsch`, `spring-sale`).                                                                             |
| `behavior`    | object        | Behaviour in the basket.                                                                                                          |
| `visible`     | bool          | Indicates whether the position is visible in the basket.      <br />Default: **true**                                             |
| `removable`   | bool          | Indicates whether the position can be removed from the basket by the shopper.      <br />Default: **true**                        |
| `changeable`  | bool          | Indicates whether the position can be changed by the shopper in the basket, e.g. quantity / variant.      <br />Default: **true** |
