simpleCart(js)

items
Items:
Total:

'beforeRemove' Event

The ‘beforeRemove’ event is triggered when an item is about to be removed from the cart.  It passes a single parameter of the Item about to be removed, which can be modified.

If a callback for the event returns false, the item will not be removed.


// simple callback example
simpleCart.bind( 'beforeRemove' , function( item ){
  console.log( item.get('name') + " was removed from the cart" ); 
});

 

Comments

  1. Sep 02, 2012

    Christian Nikkanen  said:

    I have a problem with this. I have this function stated to be executed before an item removal:
    function RemoveProduct(){return confirm(“Poista?”);}

    But here’s what it does:
    It simply asks to confirm the removal of a product, but it doesn’t really care about the selection, if it returns true, it removes it, if it returns false it removes it. Any help?

Commenting is not available in this channel entry.