Getting collection product count in Liquid from link object

Highlighted
Shopify Partner
28 0 9

When referencing a collection on another page from a link object, is there any way to get the count of products in the collection if it's filtered by tag?

ie:

{{ link.object.products_count }}

Right now it seems that when I call this on a collection link, I can't get the product count, and if I try to grab information on one of the products in the collection, the .products object is actually the unfiltered collection.

0 Likes
Excursionist
52 0 10

You could try this:

{% for link in linklists.somelinklist.links %}
<a href="{{ link.url }}">{{ link.title }} ({{ collections.[link.handle].all_products_count }})</a>
{% endfor %}

It's what we use in our footer for listing out some collections and how many products are in each.

Stay Cool... with Shopify. -Brian
0 Likes