I have to show the total quantity of the items in the cart. I'm doing this now with:
$objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $cart = $objectManager->get('\Magento\Checkout\Model\Cart'); $totalItems = $cart->getQuote()->getItemsCount(); $totalQuantity = $cart->getQuote()->getItemsQty(); echo $totalQuantity;
I have 5 items in the cart and the $totalQuantity will show 5.0000 Why is that? And how can I just display 5?