In the past, we introduced the JS function addToCart
that can be used to add various items to the cart see a post here.
As a complementary function we added function to remove an item from the cart available in Shoptet structure: shoptet.cartShared.removeFromCart
. This function accepts one parameter itemId
formed as an object. This ID can be found in a cart form as hidden input element.
The following examples use product and parameter ids from https://classic.shoptet.cz/.
/* Add product */
shoptet.cartShared.addToCart({priceId: 1745});
/* Remove added product */
shoptet.cartShared.removeFromCart({itemId: '610a403f6a8fa'});
Please note that the function removes an item even if an amount is greater than one.