How to get Current cart count in Magento2:
We may want to show current cart count in website header or some where (default it will visible on mini cart). Other than mini cart if you want to show then using below script we will achieve.
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$quoteId = $objectManager-> create(‘Magento\Checkout\Model\Session’)->getQuoteId();
$cartData = $objectManager->create(‘Magento\Quote\Model\QuoteRepository’)->get($quoteId)-
>getAllVisibleItems();
$currentItemCount = count($cartData); //Current cart quote count
echo $currentItemCount;
“SAVE Agriculture !!! Respect FARMERS.“