How to write a code that needs to run based on any change happening in the cart.

When extending the cart view, when any values like quantity or cart add/remove is happening and we need to update any values in the cart according to the change we can use the following code:

 this.model.on('change', function(){
//here you add your code according to the requirement
}

This function will run every time an update happened in the model

Leave a comment

Your email address will not be published. Required fields are marked *