Hi All
I need help with the code (or if anyone else has any other ideas) regarding how to hide navigation menu items in my mega menu if no products are in linked collection under the Impulse Theme.
Also It would be awesome to have the number of products displayed next to each remaining menu item.
My site is www.commoddities.com.au
See picture below for what I would like to achieve, with the crossed out items needing to not apear at all and the numbers being examples of what would be nice to see next to each item (FORGIVE MY DODGY PAINT EDITIING SKILLS!)
Hi @kostamilonakos
The lines contain the links of the Collections sent by Shopify to the storefont and it only contains the links to those pages. As such, the data only includes a path, not data such as the number of products in the collection, so what you want I think is not feasible. If you want to hide Linked Collection, you can customize it.
We hope the information will be useful for you.
Hi fair enough about the number showing up i can live without that, but it would be nice to hide any of the menues / sub menu items if there are no items currently in them. Can you please advise how I would achieve this in the impulse theme? Thanks
Hi,
You can use the liquid for collections with a handle to count products:
collections[‘handle-collection’].products_count
=> The total number of products in the current view of the collection.
I hope this can help you.