Hide the number of products on the shopping cart when it is empty I copy the file "commerce-cart-block.html.twig" in my sub-theme. Currently it displays my shopping cart with the number of products inside.

I want that when there is no product in it, the shopping cart remains displayed and the number disappears.

How to do this ?

&lt;div{{ attributes}}&gt;
  &lt;div class="cart-block--summary"&gt;
    &lt;a class="cart-block--link__expand" href="{{ url }}"&gt;
      &lt;span class="fa fa-shopping-basket"&gt;&lt;/span&gt;
      &lt;span class="badge"&gt;{{ count }}&lt;/span&gt;
    &lt;/a&gt;
  &lt;/div&gt;
  {% if content %}
  &lt;div class="cart-block--contents"&gt;
    &lt;div class="cart-block--contents__inner"&gt;
      &lt;div class="cart-block--contents__items"&gt;
        {{ content }}
      &lt;/div&gt;
      &lt;div class="cart-block--contents__links"&gt;
        {{ links }}
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  {% endif %}
&lt;/div&gt;
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 %}