I want to write an observer function which will fire whenever the cart total is changing.

Eg: When add/remove products in the cart, 
Add rewards/coupon codes to the cart

My observer function will check whether the cart grand total is greater than zero. If not it will do some calculation with the grand total and save that calculated value to the quote.

I have tried the following events. But non of them fulfilled the requirement.


Any suggestions will be appreciated. Thanks in advance.

  • have you tried sales_quote_collect_totals_after? – Kristof at Fooman Oct 22 '13 at 15:59
  • I tried it. But it's not firing when you doing the above mentioned activities in the cart. – Sukeshini Oct 22 '13 at 16:39
  • That sounds strange. The CartController addAction calls $cart->save(); which in turn uses $this->getQuote()->collectTotals(); The updatePostAction uses $cart->updateItems($cartData)->save(); and lastly couponPostAction uses $this->_getQuote()->setCouponCode(strlen($couponCode) ? $couponCode : '')->collectTotals()->save(); I would suggest comparing your installation against a default Magento install to see where it differs. – Kristof at Fooman Oct 22 '13 at 17:19

The following event did the trick.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.