Update total products and price in cart Magento

magento

After add or remove number products in cart by code. Example: event

This code will update total number of products and price in current cart.

Code update total products and price in cart Magento:

            

Mage::getModel('checkout/cart')->getQuote()->setTotalsCollectedFlag(false)->collectTotals()->save();
  • setTotalsCollectedFlag(false): Is False will apply this update code

 

View more detail at function collectTotals() in app/code/core/Mage/Sales/Model/Quote.php.