Reputation: 31
How to do Shopify Drop-Down Menu: Show collection product count? I am working on a Shopify Store here and need to display the product count for each collection in the drop-down sub-menu and somehow I can not figure it out. The documentation is a little bit light on this issue. I need the product count to be shown only in the sub-menus.
Upvotes: 1
Views: 3661
Reputation: 301
You can do like this: In your header file
Step 1:
After:
{% for childlink in link.links %}
ADD these two lines:
{% assign collection_handle = childlink.url | split: "collections/" | last %}
{%- assign current_collection = collections[collection_handle] -%}
Step 2:
After
{{ childlink.title | escape }}
ADD
<span>{{ current_collection.all_products_count }}</span>
Note: But keep in mind all links of the menu should be assigned to collections
Upvotes: 1