Hide mega menu links that contain 0 product

Hide mega menu links that contain 0 product

Add the following in the mega-menu-list.liquid

Idea
  {% 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 | modulo: links_before_wrap %}
            <li
              {% if break_after_modulo == 0 and should_break_columns %}
                style="break-after: column;"
              {% endif %}
            >
              <a
                href="{{ childLink.url }}"
                class="mega-menu__link"
              >
                <span class="mega-menu__link-title">{{- childLink.title -}}</span>
              </a>
            </li>
      {% endif %}{% endif %}
          {% endfor %}