Add a removal icon to item cell of the checkout. When the icon is clicked, the item will be removed from checkout page
Entry point
_.extend(OrderWizardModuleCartItemsShip.prototype, {
events: {
'click [data-action="remove-item"]': "removeItem",
},
/*function is used for remove item */
removeItem: function removeItem(e) {
var self = this;
var currentitemid = this.$(e.target)[0].attributes['data-id'].value
var cart = container.getComponent('Cart');
var quantityData = this.model.attributes.lines.models;
var currentQuantity
_.each(quantityData, function (params) {
if (params.attributes.item.id == currentitemid) {
currentQuantity = params.attributes.quantity
}
})
currentQuantity = -currentQuantity;
// console.log(cart.addLine(line(currentitemid)));
cart.addLine({
line: {
quantity: currentQuantity,
item: {
internalid:currentitemid
}
}
})
return true;
},
})
In the corresponding theme file where u need to remove add the correct data action in it