Hello,
I am trying to make collections in my navigation bar only visible if there are products in the collection.
So i tried following code in my CSS file:
.section-header .navigation .navigation__tier-2 > .navigation__item {
{% if {{ collection.all_products_count }} == 0 %}
display: none;
{% else %}
display: inline-block;
{% endif %}
}
Unfortunally {{ collection.all_products_count }} is not returning any value. I tested this by adding ::after to the code, like this:
.section-header .navigation .navigation__tier-2 > .navigation__item::after {
content: "bla bla {{ collection.all_products_count }} bla bla";
{% if {{ collection.all_products_count }} == 0 %}
display: none;
{% else %}
display: inline-block;
{% endif %}
}
It looks like this in the front-end:
I don’t really know how to fix it. I would appreciate some help.
Thanks in advance



