Skip to main content

Removing a product from the cart

Description

The rrApi.removeFromBasket method prevents the “Abandoned Cart” trigger from firing for a product that the user removed from the cart.

Call the method after removing the product from the cart and pass its identifier.

Product ID

<product_id> is the identifier of the removed product. It must match the identifier of this product in the product database.

Code example

<script type="text/javascript">
(window["rrApiOnReady"] = window["rrApiOnReady"] || []).push(function() {
try {
rrApi.removeFromBasket(<product_id>);
} catch (e) {}
});
</script>

String identifier support

If products in the product database have string identifiers, pass an object with the isProductIdString parameter as the second argument.

<script type="text/javascript">
(window["rrApiOnReady"] = window["rrApiOnReady"] || []).push(function() {
try {
rrApi.removeFromBasket(<product_id>, {"isProductIdString": true});
} catch (e) {}
});
</script>