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

# Stock

> Extend the basket reservation time in WEBSALE templates by loading reservation data via wsInventory.loadReservation for the current basket item.

Example for extending the reservation time in the basket

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

{{var $reservation = $wsInventory.loadReservation($basketItem.id)}}

{{ if $reservation }}


   {{ var $inventoryReserveAction = $wsActions.create("InventoryReserve", tag=$basketItem.id) }}
   {{ if $reservation.duration > 0 }}

      {{ var $sec = $reservation.duration % 60 }}

      {{ var $min= ( $reservation.duration - $sec ) / 60 }}

      The product is still reserved for you for
      {{ if $min > 0 }}
         <strong>{{= $min }} minutes</strong> and
      {{ /if }}
      <strong>{{= $sec }} seconds</strong>
   {{ else }}
      Unfortunately, your reservation has expired.


      <form method="post" action="{{ $wsViews.viewUrl('basket.htm') }}">
         <input type="hidden" name="wscsrf" value="{{= $inventoryReserveAction.csrf }}">
         <input type="hidden" name="wsact" value="{{= $inventoryReserveAction.id }}">
         <input type="hidden" name="wstarget" value="{{= $wsViews.viewUrl('basket.htm') }}">
         <input type="hidden" name="basketItemId" value="{{= $basketItem.id }}">
         <button>Reserve again</button>
      </form>
   {{ /if}}



   {{ if $inventoryReserveAction.success }}
      <div class="alert alert-success">Quantity was successfully reserved again.</div>
      {{ if $inventoryReserveAction.successInfo.oldQuantity != $inventoryReserveAction.successInfo.newQuantity}}
         <div class="alert alert-warning">The quantity had to be changed due to insufficient stock from
            <strong>{{= $inventoryReserveAction.successInfo.oldQuantity | preparedFormat('amount') }}</strong>
            to
            <strong>{{= $inventoryReserveAction.successInfo.newQuantity | preparedFormat('amount') }}</strong>
         </div>
      {{ /if }}
   {{ /if }}

   {{ if $inventoryReserveAction.error }}
      <div class="alert alert-danger">
         Errors occurred:
         <ul>
            {{ foreach $error in $inventoryReserveAction.errors }}
            {{ if $error.text }}
                  <li> {{= $error.text }} </li>
               {{ else }}
                  <li> {{= $error.code }} </li>
               {{ /if }}
            {{ /foreach }}
         </ul>
      </div>
   {{ /if }}
{{ /if }}
```


## Related topics

- [Storefront API Stock](/en/schnittstellen/storefront-api/storefront-api-lagerbestand.md)
- [$wsInventory - Stock](/en/frontend/referenz/module/wsinventory.md)
- [content - Catalogue (categories & products)](/en/konfiguration/content-katalog-kategorien-produkte.md)
- [Storefront API Customer Account](/en/schnittstellen/storefront-api/storefront-api-kundenkonto.md)
- [Inventory](/en/frontend/referenz/aktionen/inventory.md)
