Hide the number of products on the shopping cart when it is empty

by marsouin   Last Updated November 13, 2017 16:07 PM

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 ?

<div{{ attributes}}>
  <div class="cart-block--summary">
    <a class="cart-block--link__expand" href="{{ url }}">
      <span class="fa fa-shopping-basket"></span>
      <span class="badge">{{ count }}</span>
    </a>
  </div>
  {% if content %}
  <div class="cart-block--contents">
    <div class="cart-block--contents__inner">
      <div class="cart-block--contents__items">
        {{ content }}
      </div>
      <div class="cart-block--contents__links">
        {{ links }}
      </div>
    </div>
  </div>
  {% endif %}
</div>


Related Questions


Drupal Submit button for Smart Doc Page

Updated February 09, 2017 14:03 PM


ShareThis Module is not working properly

Updated September 07, 2017 18:07 PM