Magento 2 show cart items count in header


Magento 2 show cart items count in header We can use Magento\Checkout\Helper\Cart to get the items count in header.


Magento 2 show cart items count in header Example

You can get the total number of items and display count in header simply as below-

Magento 2 show cart items count in header Example:

$counter = $this->helper('\Magento\Checkout\Helper\Cart'); 
echo $counter->getItemsCount();

Advertisements

Add Comment

📖 Read More