Is there an observer which can be used to observe events when a product is removed from the cart? I haven't found any.
What I have found is checkout_cart_update_items_after
which can be used if a product is removed by altering the product count, but not when the user uses the remove button. The only alternative I see in the moment is checkout_cart_save_after
which is used whenever the cart changes. Of course this needs custom logic which check which product was removed. Not perfect.
So is there a better way to watch out for remove events?
You can use the sales_quote_remove_item
event, dispatched in Mage_Sales_Model_Quote::removeItem()
.
The removed item is passed to the observer as an argument.
Mage::dispatchEvent('sales_quote_remove_item', array('quote_item' => $item));
To get the associated product model in an event observer, use $observer->getQuoteItem()->getProduct()
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With