0

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.

1 Answer 1

1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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