On my website header I have a shopping cart icon with a badge that display the number of the items in the cart. When you enter in the website, it should display 0, as you have no item in the cart. However the badge is empty until you add a item in the cart. But if you later remove all items than it does display 0.

i want the cart to have 0 items when you visit the website

  • 1
    can you post your cart file code here if possible ??
    – Arunendra
    Commented Sep 16, 2015 at 4:26

1 Answer 1


You can do something like this so when you don't have any item in your cart it will display 0.

<?php $_cartQty = $this->helper('checkout/cart')->getSummaryCount(); ?>

<?php echo '<span class="summary-qty">' . ($_cartQty ? $_cartQty : 0) . '</span>' ?>

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.