Skip to main content
This section describes the available actions in the watchlist area. With these actions, products can be added to or removed from the watchlist.

Actions overview

ActionDescription
WatchListItemAddAdds one or more products to the watchlist.
WatchListItemDeleteRemoves a product from the watchlist.
AddWatchListCreates a new watchlist.
DeleteWatchListDeletes an existing watchlist.
RenameWatchListRenames an existing watchlist.

Actions

WatchListItemAdd

This action adds a product to the user’s watchlist. Both individual products and multiple products can be passed simultaneously. Usage example
Can be used on product or category pages where customers can add items to their watchlist to find or buy them later.
Parameters
NameDescription
productIdThe ID of the product to be added to the watchlist.
freeFields.<identifier>Optional free fields that can be assigned to the watchlist entry.
multiProducts.<productId>.<quantity>Allows multiple products to be added simultaneously with their respective quantities.
Error codes
Error codeDescription
missingProductIdParameter productId is missing or empty.
invalidProductIdThe product with the specified productId does not exist.
invalidVariantIdThe specified variant of the product is invalid or does not exist.
Related modules, variables & methods Example showing how a product is added to the default watchlist.
{{ var $myActionWatchListItemAdd = $wsActions.create("WatchListItemAdd") }}
<form method="post" action="{{= $wsViews.current.url() }}">
    <input type="hidden" name="wsact" value="{{= $myActionWatchListItemAdd.id }}">
    <input type="hidden" name="wscsrf" value="{{= $myActionWatchListItemAdd.csrf }}">
    <input type="hidden" name="productId" value="{{= $myProduct.id }}">
    <input type="hidden" name="watchListIds.default" value="default">
    <button type="submit">Add to watchlist</button>
</form>

WatchListItemDelete

This action removes an entry from the user’s watchlist. Usage example
Can be used on the watchlist page where customers can delete individual products from their watchlist.
Parameters
NameDescription
watchListItemIdThe ID of the watchlist entry to be deleted.
Error codes
Error codeDescription
missingWatchListItemIdParameter watchListItemId is missing or empty.
Related modules, variables & methods Example showing how a product is removed from the default watchlist by its watchlist entry ID.
{{ var $myActionWatchListItemDelete = $wsActions.create("WatchListItemDelete") }}
{{ var $myWatchListItemId = $wsWatchList.loadWatchListItemId("default", $myProduct.id) }}
<form method="post" action="{{= $wsViews.current.url() }}">
    <input type="hidden" name="wsact" value="{{= $myActionWatchListItemDelete.id }}">
    <input type="hidden" name="wscsrf" value="{{= $myActionWatchListItemDelete.csrf }}">
    <input type="hidden" name="productId" value="{{= $myProduct.id }}">
    <input type="hidden" name="watchListItemId" value="{{= $myWatchListItemId }}">
    <button type="submit">Remove from watchlist</button>
</form>

AddWatchList

This action creates a new watchlist for the logged-in user. Usage example
Can be used on the watchlist management page where customers can create additional watchlists, e.g., for various occasions or categories.
Parameters
NameDescription
watchListNameThe name of the new watchlist.
Error codes
Error codeDescription
notLoggedInThe user is not logged in.
missingWatchListNameParameter watchListName is missing.
Related modules, variables & methods Example showing how a new watchlist is created via an input field.
{{ var $myActionAddWatchList = $wsActions.create("AddWatchList") }}
<form method="post" action="{{= $wsViews.current.url() }}">
    <input type="hidden" name="wsact" value="{{= $myActionAddWatchList.id }}">
    <input type="hidden" name="wscsrf" value="{{= $myActionAddWatchList.csrf }}">
    <input type="text" name="watchListName">
    <button type="submit">Create new watchlist.</button>
</form>

DeleteWatchList

This action deletes an existing watchlist of the logged-in user. Usage example
Can be used on the watchlist management page where customers can remove watchlists they no longer need.
Parameters
NameDescription
watchListIdThe ID of the watchlist to be deleted.
Error codes
Error codeDescription
notLoggedInThe user is not logged in.
missingWatchListIdParameter watchListId is missing.
invalidWatchListIdThe specified watchlist does not exist or does not belong to this user account.
Related modules, variables & methods Example showing how a watchlist is deleted via a button.
{{ var $myActionDeleteWatchList = $wsActions.create("DeleteWatchList") }}
<form method="post" action="{{= $wsViews.current.url() }}">
    <input type="hidden" name="wsact" value="{{= $myActionDeleteWatchList.id }}">
    <input type="hidden" name="wscsrf" value="{{= $myActionDeleteWatchList.csrf }}">
    <input type="hidden" name="watchListId" value="{{= $myWatchList.watchListId }}">
    <button type="submit">Delete watchlist.</button>
</form>

RenameWatchList

This action renames an existing watchlist of the logged-in user. Usage example
Can be used on the watchlist management page where customers can adjust the name of an existing watchlist.
Parameters
NameDescription
watchListIdThe ID of the watchlist to be renamed.
watchListNameThe new name of the watchlist.
Error codes
Error codeDescription
notLoggedInThe user is not logged in.
missingWatchListIdParameter watchListId is missing.
missingWatchListNameParameter watchListName is missing.
invalidWatchListIdThe specified watchlist does not exist or does not belong to this user account.
Related modules, variables & methods Example showing how a watchlist is renamed via an input field.
{{ var $myActionRenameWatchList = $wsActions.create("RenameWatchList") }}
<form method="post" action="{{= $wsViews.current.url() }}">
    <input type="hidden" name="wsact" value="{{= $myActionRenameWatchList.id }}">
    <input type="hidden" name="wscsrf" value="{{= $myActionRenameWatchList.csrf }}">
    <input type="hidden" name="watchListId" value="{{= $myWatchList.watchListId }}">
    <input type="text" name="watchListName" value="{{= $myWatchList.watchListName }}">
    <button type="submit">Rename watchlist.</button>
</form>