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

# CB- (Cookie basket)

> The tags for the cookie basket: inform the buyer which products from their saved basket could not be restored.

The cookie basket retains a buyer's basket beyond the session. If someone puts products in the basket but does not order, and comes back days later, they find their basket waiting.

When the basket is refilled, not everything always works out. A product may be sold out, discontinued or no longer in the range. The tags with the prefix `CB-` exist exclusively for this case: they tell the buyer what is missing and why their basket is smaller than expected.

Guide: Using the cookie basket

## The two messages

The cookie basket comes with two notices to the buyer, and only one of them comes from this tag group.

| Tag | Reports | Prefix |
| - | - | - |
| `WS-BasketFromCookie` | products were restored from the cookie basket | WS- |
| `CB-Notify` | products could not be restored | CB- |

> [!NOTE]
>
> The two are not mutually exclusive. If three of five saved products were restored and two were not, both areas apply. Therefore, build the message as one coherent notice and not as two separate boxes.

Reference: WS-BasketFromCookie

## The complete example

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{WS-BasketFromCookie}
   <div class="hinweis">
      Wir haben Ihren Warenkorb vom letzten Besuch wiederhergestellt.

      {CB-Notify}
         {CB-NotifyData}
            Diese ~CB-NotifyData~ Positionen sind leider nicht mehr verfügbar:
            <ul>
               {@CB-NotifyData}
                  <li>
                     ~CB-NotifyQuantity~ x ~CB-NotifyProdName~
                     {CB-NotifyProdNumber}(Art.-Nr. ~CB-NotifyProdNumber~){/CB-NotifyProdNumber}
                  </li>
               {/@CB-NotifyData}
            </ul>
         {/CB-NotifyData}
      {/CB-Notify}
   </div>
{/WS-BasketFromCookie}
```

> [!WARNING]
>
> All tags in this group are permitted on all templates. Nevertheless, only place the message in a spot that the buyer sees when the first page is built. The notice only appears once, and on a page they never open, it is lost.

## CB-Notify

Applies if at least one product could not be restored when the cookie basket was read in. The area is only displayed once.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{CB-Notify}
   Einige Produkte aus Ihrem gespeicherten Warenkorb sind nicht mehr verfügbar.
{/CB-Notify}
```

> [!NOTE]
>
> For the area to apply, the cookie basket must actually have been read in during this page request. On every further request in the session, it stays empty, even if the products are still missing.

> [!WARNING]
>
> The one-time display is built so that it does not slow down the current page build. In rare cases, the notice may therefore appear a second time. Word the message so that a repetition does not bother anyone, and do not attach any action to it that may only happen once.

> [!WARNING]
>
> `CB-Notify` is exclusively a positive area tag. There is no negative area tag and no single tag form. For the case "everything could be restored", use `{!CB-NotifyData}` instead.

## CB-NotifyData

The central tag of the group, in three roles.

| Usage | Result |
| - | - |
| Single tag | the number of items that could not be restored |
| Area tag | applies if there are such items |
| Loop tag | runs over these items |

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{CB-NotifyData}
   ~CB-NotifyData~ Positionen konnten nicht übernommen werden.

   {@CB-NotifyData}
      ...
   {/@CB-NotifyData}
{/CB-NotifyData}

{!CB-NotifyData}
   Ihr gespeicherter Warenkorb wurde vollständig wiederhergestellt.
{/!CB-NotifyData}
```

> [!NOTE]
>
> The difference from `CB-Notify` lies in the duration. `CB-Notify` applies once at the moment of reading in, `CB-NotifyData` as long as the data is present in the session. For a one-time message, use `CB-Notify`; for a list that the buyer should still be able to view later, use `CB-NotifyData`.

## The details per item

Five tags return the data of the individual item. All five are only permitted within the loop `{@CB-NotifyData}`.

| Tag | Returns |
| - | - |
| `CB-NotifyPosition` | the sequential number within the loop |
| `CB-NotifyProdName` | the product name |
| `CB-NotifyProdNumber` | the product number |
| `CB-NotifyProdIndex` | the product index |
| `CB-NotifyQuantity` | the quantity of this item |

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{@CB-NotifyData}
   <tr>
      <td>~CB-NotifyPosition~</td>
      <td>~CB-NotifyProdName~</td>
      <td>{CB-NotifyProdNumber}~CB-NotifyProdNumber~{/CB-NotifyProdNumber}</td>
      <td>~CB-NotifyQuantity~</td>
   </tr>
{/@CB-NotifyData}
```

> [!NOTE]
>
> `CB-NotifyProdName`, `CB-NotifyProdNumber` and `CB-NotifyProdIndex` can also be used as area tags and then apply if a value is present. This is not possible with `CB-NotifyPosition` and `CB-NotifyQuantity`; they are single tags only.

> [!WARNING]
>
> The quantity is output without decimal places. For products sold by the metre or kilogram, a rounded number is shown. This is sufficient for a list of products that are no longer available, but not for further processing.

### Making good use of the product index

`CB-NotifyProdIndex` is the only detail you can use for something beyond the plain message.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{@CB-NotifyData}
   ~CB-NotifyProdName~
   {CB-NotifyProdIndex}
      <a href="~PR-Link($CB-NotifyProdIndex$)~">Produkt ansehen</a>
   {/CB-NotifyProdIndex}
{/@CB-NotifyData}
```

> [!NOTE]
>
> A product that is currently sold out still exists. A link to it gives the buyer the opportunity to sign up for the back-in-stock notification instead of merely taking note of the message. For products that have been removed from the range, however, the link leads nowhere; check this for your shop.

## What you should know about the cookie basket

> [!WARNING]
>
> The cookie basket must be activated for your shop. It consumes additional performance units because data is written every time the basket changes. Also coordinate its use with your data protection officer.

| Setting | Value |
| - | - |
| Storage duration | 30 days by default, at most 60 |
| Saved items | at most the first 200 products in the basket |
| Reading in after login | optional, configurable per subshop |

> [!WARNING]
>
> If your shop uses customer-specific prices, the cookie basket may only be read in after login. Otherwise, the buyer gets the standard prices instead of their own. This must be explicitly configured and is required for closed shops anyway.

## The tags at a glance

| Tag | Single tag | Area tag | Negative area tag | Loop tag |
| - | - | - | - | - |
| `CB-Notify` | – | yes | – | – |
| `CB-NotifyData` | yes | yes | yes | yes |
| `CB-NotifyPosition` | yes | – | – | – |
| `CB-NotifyProdName` | yes | yes | yes | – |
| `CB-NotifyProdNumber` | yes | yes | yes | – |
| `CB-NotifyProdIndex` | yes | yes | yes | – |
| `CB-NotifyQuantity` | yes | – | – | – |

All tags are permitted on all templates. The five tags for the individual item only apply within the loop `{@CB-NotifyData}`.

## Related topics

* Guide: Using the cookie basket
* Guide: Saveable basket
* Materials: Cookies used
* Reference: WS-BasketFromCookie


## Related topics

- [$wsSubshop - Subshop](https://dokumentation.websale.de/en/frontend/referenz/module/wssubshop.md)
- [general - General shop settings](https://dokumentation.websale.de/en/konfiguration/general-allgemeine-shopeinstellungen.md)
- [basket - Basket](https://dokumentation.websale.de/en/konfiguration/basket-warenkorb.md)
- [Shopping basket and order process](https://dokumentation.websale.de/en/v8s/referenz/konfigurationen/shopkonfiguration-shop-config/warenkorb-und-bestellprozess.md)
- [Basket](https://dokumentation.websale.de/en/frontend/referenz/aktionen/basket.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.