Hi, I am trying to hide the empty collections from the collection page using the below code
{% for collection in collections %}
{% if collection.products_count != 0 %}
{% include 'collection-grid-item' %}
{% endif%} {% endfor %}
but the empty collections are not hiding here is the collection page link https://pcmart.ae/collections. Would be grateful if you help me. here is the complete code for the main-list-collection
{% if settings.Collection_type =='show_category' %}
{% if settings.use_custom_list_collection %}
{% assign collection = link.object %}
{% else %}
{%- for collection in collections -%}
{% unless collection.handle == 'frontpage' %}
{% if settings.collection_grid_column == '3' %}
{% assign collection_item_width = 'grid__item wide--one-third post-large--one-third large--one-third small--grid__item col-sm-4 col-xs-6' %}
{% elsif settings.collection_grid_column == '2' %}
{% assign collection_item_width = 'grid__item wide--one-half post-large--one-half large--one-half col-sm-6 col-xs-6' %}
{% elsif settings.collection_grid_column == '4' %}
{% assign collection_item_width = 'grid__item wide--one-quarter post-large--one-quarter large--one-quarter col-sm-3 col-xs-6' %}
{% endif %}
{% assign featured = collection.handle %}
{% unless collection_item_width %}
{% assign collection_item_width = 'small--grid__item medium--one-tenth wide--one-tenth' %}
{% endunless %}
{% assign collection_item_img_size = '600x' %}
{% if collection.featured_image %}
{{ collection.featured_image | img_url: collection_item_img_size | img_tag: collection_title }}
{% else %}
{{ collection.products.first.featured_image | img_url: collection_item_img_size | img_tag: collection_title }}
{% endif %}
{{- collection.title -}}
{{ collection.all_products_count }} {{ 'cart.general.items' | t }}
{% endunless %}
{% endfor %}
{% endif %}
{% else %}
{%- for collection in collections -%}
{% unless collection.handle == 'frontpage' %}
{% render 'collection-lists' %}
{% unless forloop.last %}
---
{% endunless %}
{% endunless %}
{% endfor %}
{% endif %}
{{ 'masonry.js' | asset_url | script_tag }}