Magento – Issue with bundle product price not changed on cart page

bundlecartce-1.7.0.2price

I made custom calculation to change product price on cart page.

Product type is bundle.

I used this observer event to set custom price for bundle product.

checkout_cart_product_add_after

My code to set custom price.

 $item->setCustomPrice($final_price);
 $item->setOriginalCustomPrice($final_price);
 $item->getProduct()->setIsSuperMode(true);

Issue is that product price is changed, rowtotal is also changed but grand total and subtotal of cart was not changed. grandtotal and subtotal take bundle product original price not my calculated price.

Bundle product price type is dynamic.

But when I create bundle product price type fixed custom price calculation is working perfectly.

Best Answer

To update the cart via an observer don't forget:

$quote = $observer->getEvent()->getQuote();
$quote->setTotalsCollectedFlag(false)->collectTotals();

https://stackoverflow.com/questions/14362702/magento-programatically-update-cart-via-event