Loop vendors on collection page - Sort by size or anything

Topic summary

A user wants to create five buttons on a collection page to filter products by vendor, but needs to display the five most relevant vendors rather than an alphabetical list.

Current limitation:

  • Shopify’s collection.all_vendors only returns vendors alphabetically
  • The user needs to sort/filter vendors by relevance (such as vendor size or product count)

Attempted solution:
The user has created a Liquid loop that displays vendors with a 5-item limit, but cannot control the sorting criteria beyond alphabetical order.

Open question:
Seeking methods to sort or filter the vendor list by size, product count, or other relevance metrics instead of alphabetical order. No solutions or responses have been provided yet.

Summarized with AI on November 19. AI used: claude-sonnet-4-5-20250929.

Hello
I want to make five buttons on the collection page to sort/search by vendor. I’ve made a loop to display five vendors. But Shopify only allows me to take collection.all_vendors
This will just display it alphabetically and i need to show the five most relevant venders, by the size of the vendor or something like that.

I made this so far, but i don’t know if it is possible to filter/sort it by size or anything?


            {%  assign allevendor = collection.all_vendors %}

            {% for vendors in allevendor limit:5 %}
              {% if forloop.length > 0 %}
- ###### {{ vendors | upcase }} {{ collection.title | upcase }}
            
        
{% unless forloop.last %}{% endunless -%}
  {%- endif -%}
{% endfor %}