I am trying to figure out how to display the current cart count in a span outside of the mini cart. I have tried to add data-bind="html: getCartParam('subtotal')
into the span but I get an error:
Uncaught ReferenceError: Unable to process binding "html: function (){return getCartParam('subtotal') }"
Message: getCartParam is not defined
I am able to add this:
<?php echo $this->helper('\Magento\Checkout\Helper\Cart')->getItemsCount(); ?>
which will give me the cart count but it will break as soon as full page cache is enabled. Is there anyway to accomplish what I want?
EDIT:
<?php
$counter = $this->helper('\Magento\Checkout\Helper\Cart');
?>
<div class="customerInformation">
<span class="customer-icon contact-phone-icon" aria-hidden="true"></span>Call Now <a href="tel:<?php echo $block->getPhoneNumber(); ?>"><?php echo $block->getPhoneNumber(); ?></a>
<a href="/checkout/cart"><span class="lang-icon bag-icon"></span> Bag <span class="badge"><?php echo $counter->getItemsCount(); ?></span></a>
</div>
EDIT 2:
app/code/Vendor/Module/view/frontend/templates/customerInformation.phtml