Hide collection card with 0 product in collection list

Hide collection card with 0 product in collection list

In collectionlist.liquid, add 

{% capture list_items %}
{% for collection in section_collections limit: max_items %}
Notes
{% if collection.products_count > 0 %}

<div class="resource-list__item">
{% content_for 'block', type: '_collection-card', id: 'static-collection-card', closest.collection: collection %}
</div>
{% unless forloop.last %}
<!--@list/split-->
{% endunless %}

Notes{% endif %}

{% endfor %}
{% endcapture %}


    • Related Articles

    • Hide products in all collection

      Add this code in main-collection-product-grid.liquid: {% for product in collection.products %} {% unless product.metafields.seo.hidden.value == 1 %} {% render 'product-card', product: product %} {% endunless %} {% endfor %}
    • Make collection list carousel/grid not show when there isn't any collection is chosen

      In base.css, add the following in the end of the file /* These are sections with placeholders that we don't want to have appear on the storefront when empty */ .shopify-section:has(.in-onboarding-state) { /* stylelint-disable-next-line ...
    • Hide collection with 0 products in mega menu list

      In mega-menu-list.liquid, add the followings: {% for childLink in link.links %} {% if childLink.object.products_count > 0 %} {% assign break_after_modulo = forloop.index | modulo: links_before_wrap %} <li {% if break_after_modulo == 0 and ...
    • Hide products from Google & Shopify Search

      1. Access Your Shopify Admin Log in to your account to enter the backend of your store. Familiarize yourself with the intuitive Shopify admin page and interface, setting the stage for effortless product management. Think of it as your store's control ...
    • Hide mega menu links that contain 0 product

      Add the following in the mega-menu-list.liquid {% for childLink in link.links %} {% if link.type == 'collection_link' %} {% assign collection = link.object %} {% if collection.products_count > 0 %} {% assign break_after_modulo = forloop.index | ...