Any way to sort alphabetically by vendor?

New Member
4 0 0

Hello. I am trying to get my store to sort alphabetically by vendor. It's an online record store and I would like it to sort by artist's last name, so Miles Davis sorts before Art Pepper (under D and P respectively instead of M and A). Since I can't do this by SKU, or by product title without using the names "Davis, Miles" and "Pepper, Art" (or even worse something like "Beatles, The") I was hoping I could enter the names in Vendor that way and sort them like that. I am using the Debut theme but am open to switching if there's a way to do this. Thanks!

Shopify Partner
142 4 16

Something like this should get a list of vendors by alphabet


{% assign chars = '' %}
{% for vendor in shop.vendors %}
    {% capture first_char %}{{ vendor | truncate: 1, ''  | upcase}}{% endcapture %}

    {% if forloop.first %}
            <ul id="vendorlist">
    {% endif %}

    {% unless chars contains first_char %}
        {% unless forloop.first %}
              <div style="clear:both;"></div>
        {% endunless %}

            <h2>{{ first_char }}</h2>
        {% capture temp %}{{ chars }}{{ first_char }}{% endcapture %}
        {% assign chars = temp %}
    {% endunless %}

    <li><a href="/collections/vendors?q={{ vendor }}&sort_by=created-descending">{{vendor | capitalize}}</a></li>
{% endfor %}