Description :
Removing a promotion from the cart. If the promotion is removed successfully, the cart total is updated and the promotion no longer appears in the cart.
Code :
var cart = container.getComponent("Cart");
if (cart) {
cart.removePromotion({promocode_internalid: "22"}).fail(function() {
console.log("Could not remove promotion.");
});
}
Parameters
Name Type Description
data Object
The promotion to remove from the cart. data is an object with a single property promocode_internalid. The value of promocode_internalid is the internal ID of the promotion. You can use the getPromotions() method to get the internal IDs of all promotions currently applied.
Returns
Deferred
Returns a Deferred object. If the promise is resolved, it indicates the promotion was removed successfully. Otherwise, if the promise fails, it returns an error message.