Skip to content

Instantly share code, notes, and snippets.

@pauldonnelly
Created October 24, 2014 10:47
Show Gist options
  • Save pauldonnelly/9850ab07d9959bd5a9e4 to your computer and use it in GitHub Desktop.
Save pauldonnelly/9850ab07d9959bd5a9e4 to your computer and use it in GitHub Desktop.
Get Cart Quantity Within A Session
<?php
function getCartQuantity () {
$cart = Mage::getModel('checkout/cart')->getQuote()->getData();
if (isset($cart['items_qty']))
return (int)$cart['items_qty'];
else
return 0;
}
echo getCartQuantity ().' Item(s)';
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment