OK, so I kind of misread your request there (in my defense, it was rather late). Let’s dive into it then:
In order to figure out the unique vendors that exist in a single collection, but not throughout the whole store, you’d need to loop through your collection’s products and loop through each one’s vendor. If we create an array where we can append each unique instance, then we can loop through that array and create a URL with a query string for each one. Kind of like this:
{% assign vendors = '' %}
{% for product in collection.products %}
{% unless vendors contains product.vendor %}
{% assign vendors = vendors | append: product.vendor | append: ', ' %}
{% endunless %}
{% endfor %}
{% assign vendors = vendors | split: ', ' | sort %}
{% for vendor in vendors %}
- {{ vendor }}
{% endfor %}
- Display all
Now, for the Display All option, I imagine that you can just add a link to the collection URL (that last li above).
I have a vague feeling that there’s an easier/more efficient way to do this (since you’d are effectively looping a collection’s products twice), but my brain isn’t working at full capacity at the moment tbh. If I come up with a better option, I’ll let you know.