I'm trying to display the shipping costs in the top cart with the following code in sidebar.phtml:

<?php echo Mage::helper('checkout')->formatPrice($this->getSubtotal()) ?>

But on the website in the cart it returns a total of 0.00.
Does anybody know what code snippet to use to display the shipping costs in the top cart

4 Answers 4


Shipping cost can only show when

1.You have checkout quote .

2.And your checkout quote has address.

By default magento taking quote address from customer default Shipping and billing address whenever you have your current quote object not have any address.

So you cannot show Shipping cost at toplinks

  • Is there a way you can display them by setting a default country and getting the shipping cost by country? Oct 15, 2014 at 13:01

You can only show the shipping costs if you have an address.

This means if you go through the checkout, add an address and then go back to the cart, should do the job.

You can somehow (with an observer maybe?) add a default address so the calculation is done "without" address.


There is an extension (https://www.magentocommerce.com/magento-connect/auto-shipping-pro.html) that replaces the 'Get a Quote' in the cart with default shipping costs. Install this and simply add this to your local.xml:

<reference name="cart_sidebar.extra_actions">
    <block type="checkout/cart_shipping" name="mini.checkout.cart.shipping" as="shipping" template="checkout/cart/shipping.phtml"/>

I think this one is too old thread but let me share a git repository, I have recently found specific to M1 - https://github.com/integer-net/Autoshipping.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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