I'm trying to get the shipping cost via an observer that is triggered on the event:


I used this code in Magento 1.7:

$shipping = 

but it does not seem to work now (always returns zero).

In addition, the following code:

$total = $quote->getTotals()['grand_total']->getData('value'); 

returns only the total to be paid without the shipping cost.

Any advice will be much appreciated.

1 Answer 1


Here is the deal: You need the collectTotals method in order for the whole thing to work (get totals with shipping cost). Here is what I've used:

$total = Mage::getModel('checkout/cart')->getQuote()->collectTotals()->getTotals()['grand_total']->getData('value');

Your Answer

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

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