I am displaying the total items present in the cart at header. I am able to display the count of items.

But I am bit confused between two methods of cart

1. Mage::helper('checkout/cart')->getItemsCount()
2. Mage::helper('checkout/cart')->getSummaryCount();

For me 1st one returns 1 item in cart and 2nd one returns 6 items in cart, Which is correct one and what is the difference these two functions..


up vote 30 down vote accepted
Mage::helper('checkout/cart')->getItemsCount() -- return shopping cart items count means how many sku add to shopping cart.
Mage::helper('checkout/cart')->getSummaryCount() -- return shopping cart items summary (suppose you add sku1 6 qty and sku2 3 qty = total 9 qty return)
  • Note: it's getItemCount() not getItemsCount() on CE 1.9.2 for Mage_Checkout_Block_Cart_Sidebar. getItemsCount() will fail silently (returning empty string) and can cause bugs due to this behaviour. – Manuel Arwed Schmidt Aug 9 '15 at 19:59

This way getItemsCount will work:


If not then try adding this above the getItemsCount line:

Mage::getSingleton('core/session', array('name'=>'frontend'));

And For Summary Count:

$count = $this->helper('checkout/cart')->getSummaryCount();  //get total

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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