0

I'm using Magento 1.9 and I want to display subtotal in the cart button. I tried with this code

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

But it still displays 0.00 in the cart, even after I added a product to cart.

enter image description here

1

You can access current subtotal wherever you want this way

Mage::getSingleton('checkout/session')->getQuote()->getSubtotal()

So, your try should be...

$subtotal = Mage::getSingleton('checkout/session')->getQuote()->getSubtotal();
echo Mage::helper('checkout')->formatPrice($subtotal);

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.