Hide the number of products on the shopping cart when it is empty
Could you not add an if around the  tag containing the {{ count }}?

since you are using Drupal 8, you can use Twig filters. One way could be like below.

{% if count &gt; 0 %}
    &lt;span class="badge"&gt;{{ count }}&lt;/span&gt;
{% endif %}