Magento How to check if the shopping cart is empty or not?

Weszzz7 picture Weszzz7 · Oct 8, 2012 · Viewed 13.8k times · Source

I am trying to check if the shopping cart is empty or not. I am trying to do this from a static block and from a phtml file.

Anyone know how to do this?

Thanks in advance

Answer

Mukesh picture Mukesh · Oct 8, 2012

I was able to find the total count of items in the shopping cart using the following code:

$totalItemsInCart = Mage::helper('checkout/cart')->getItemsCount();

If it does not work, let me know.