I tried to add a 'span' with the total quantity in cart but I have a small problem, I would like to add the red circle with quantity only if there is a product in cart. It works but when we go on another page, the red circle appears and disapears few seconds after. Do you how I can solve this problem?
Here is my code in minicart.phtml
<a class="action showcart" href="<?php echo $block->getShoppingCartUrl(); ?>" data-bind="scope: 'minicart_content'"> <span class="text"><?php echo __('My Cart'); ?></span> <!-- ko if : getCartParam('summary_count') --><span class="cart-item-count circle circle-lg circle-red"><!-- ko text: getCartParam('summary_count') --><!-- /ko --></span><!-- /ko --> </a>
one second after