How can I correct "Liquid error: comparison of String with 0 failed" when a collection is not published/ available?
If I make the collection unavailable/ not published I have "Liquid error: comparison of String with 0 failed" on the frontend.
Removing
{% if collections['catalogue'].products_count > 0 %}
shows "coming soon"
This is the line in question I think but I need to check there are products.
I've also tried adding
{% if collections['catalogue'] %}
I need the Catalogues section to be completely hidden until it's avaialble
{% if collections['catalogue'].products_count > 0 %}
<div class="contain collection collection--home" data-intro="fade-in-up">
<header role="banner" class="collection__title">
<h1 class="h3 font--condensed text--upper">Catalogues</h1>
</header>
<div class="collection-grid">
{% for product in collections['catalogue'].products limit:1 %}
{% include 'collection-item' %}
{% else %}
<p>{{ 'collections.general.no_matches' | t }}</p>
{% endfor %}
</div>
</div>
{% endif %}
sorry I'm a liquid and Shopify nooob :-/
You can check the publishing date since that is null
when is not published.
{% if collections['catalogue'].published_at != empty %}
// your code
{%- endif -%}
Please have in mind that you are checking for products count in your code but you are asking for collection availability which are 2 different things. A collection can be unavailable and still have products.
If you want to check for products swap it for:
{% if collections['catalogue'].products.size > 0 %}
// your code
{%- endif -%}