Magento – How to force shipping quote and order totals calculation on shopping cart page

shopping-cart

I have a store where, after the customer logs in, predefined products are added to shopping cart and the customer is directed to the shopping cart page. The customer has shipping country defined and this is set to quote.

This is done in customer_login observer.

The problem is that when the customer enters to the cart, it shows default country in the Estimate Shipping selector. Only after page reload the Shipping estimator and totals calculation is run, using the correct shipping country set before.

How can I force the calculation so that correct amounts are shown when the customer lands on the page?

Best Answer

Try this

Mage::getSingleton('checkout/session')->getQuote()
->setTotalsCollectedFlag(false)
->collectTotals()
->save()
Related Topic