Skip to main content
This section describes the available actions in the Inventory area. With these actions, product reservations can be renewed and back-in-stock notifications can be managed.

Actions overview

ActionDescription
InventoryReserveRenews the reservation of a product in the basket.
BackInStockActivateNotifyActivates a notification when a product is available again.
BackInStockDeactivateNotifyDeactivates an existing back-in-stock notification.

Actions

InventoryReserve

This action renews the reservation of a product in the basket. It is only relevant if the reservation duration of an item has expired and the customer wants to extend the reservation. Usage example
Can be used on the basket page when the reservation time of an item has expired and the customer should be given the option to renew the reservation.
Parameters
NameDescription
basketItemIdThe ID of the basket entry whose reservation should be renewed.
Error codes
Error codeDescription
missingBasketItemIdParameter basketItemId is missing.
invalidBasketItemIdThe basket entry does not exist or does not belong to this basket.
reservationFailedThe reservation could not be renewed, e.g., because the product is no longer available.
Related modules, variables & methods Example showing how a customer with an expired reservation is given the option to renew it via a button.
{{ var $myReservation = $wsInventory.loadReservation($myProduct.id) }}
{{ if $myReservation and $myReservation.duration == 0 }}
    {{ var $myActionInventoryReserve = $wsActions.create("InventoryReserve", tag=$myProduct.id) }}
    <form method="post" action="{{= $wsViews.viewUrl('basket.htm') }}">
        <input type="hidden" name="wscsrf" value="{{= $myActionInventoryReserve.csrf }}">
        <input type="hidden" name="wsact" value="{{= $myActionInventoryReserve.id }}">
        <input type="hidden" name="wstarget" value="{{= $wsViews.viewUrl('basket.htm') }}">
        <input type="hidden" name="basketItemId" value="{{= $myProduct.id }}">
        <button type="submit">Renew reservation.</button>
    </form>
{{ /if }}

BackInStockActivateNotify

This action activates a notification that informs the customer by email as soon as a sold-out product is available again. Usage example
Can be used on the product detail page when a product is sold out and the customer wants to be notified as soon as it can be ordered again.
Parameters
NameDescription
productIdThe ID of the product for which the notification should be activated.
emailThe email address to which the notification should be sent.
Error codes
Error codeDescription
missingProductIdParameter productId is missing.
missingEmailParameter email is missing.
emailCheckFailedThe specified email address is invalid.
Related modules, variables & methods Example showing how a customer can activate a notification for a sold-out product.
{{ var $myActionBackInStockActivateNotify = $wsActions.create("BackInStockActivateNotify") }}
<form method="post" action="{{= $wsViews.current.url() }}">
    <input type="hidden" name="wscsrf" value="{{= $myActionBackInStockActivateNotify.csrf }}">
    <input type="hidden" name="wsact" value="{{= $myActionBackInStockActivateNotify.id }}">
    <input type="hidden" name="productId" value="{{= $myProduct.id }}">
    <input type="email" name="email">
    <button type="submit">Be notified when the product is back in stock.</button>
</form>

BackInStockDeactivateNotify

This action deactivates an existing back-in-stock notification. Usage example
Can be used on the account overview page, where logged-in customers can view and remove their active notifications.
Parameters
NameDescription
productIdThe ID of the product for which the notification should be deactivated.
emailThe email address for which the notification should be deactivated.
Error codes
Error codeDescription
missingProductIdParameter productId is missing.
missingEmailParameter email is missing.
Related modules, variables & methods Example showing how an active notification is deactivated via a button.
{{ var $myActionBackInStockDeactivateNotify = $wsActions.create("BackInStockDeactivateNotify") }}
<form method="post" action="{{= $wsViews.current.url() }}">
    <input type="hidden" name="wscsrf" value="{{= $myActionBackInStockDeactivateNotify.csrf }}">
    <input type="hidden" name="wsact" value="{{= $myActionBackInStockDeactivateNotify.id }}">
    <input type="hidden" name="productId" value="{{= $myProduct.id }}">
    <input type="hidden" name="email" value="{{= $myProduct.email }}">
    <button type="submit">%%DeleteFromNotification%%</button>
</form>