Overcoming Magento’s Double Grand Total Issue

Magento will sometimes calculate the total of the cart as double what it should actually be. This occurs typically when multiple collectTotals() calls are made to the shipping address. To overcome this issue, we can clear the cached items of the quote object and recalculate from there.


$quote = Mage::getSingleton('checkout/session')->getQuote();
$quote->setTotalsCollectedFlag(false);
$quote->getShippingAddress()->unsetData('cached_items_all');
$quote->getShippingAddress()->unsetData('cached_items_nominal');

$quote->getShippingAddress()->unsetData('cached_items_nonnominal');
$quote->collectTotals()->save();


WordPress is an arse and can’t do html entities properly