How to edit sorting logic of a to z

Rozen01
Visitor
2 0 0

Hey everyone, 

I am currently working on a store and I was wondering if there's a way to edit the logic of the sorting feature within collection pages? I am familiar with coding but not much with liquid. 

I am looking to make the A-Z sorting feature so that titles with numbers will be at the bottom and the letters at the top. I was trying to play around with the liquid code, but I just can't seem to find where the logic for the sorting functions are kept. All I was able to find is where the drop down main to select each of the options is created:

 <span class="filter">
            <label for="sort-by">{{ 'collections.sorting.title' | t }}:</label>
            <select id="sort-by" class="sort-by" data-default-value="{{ collection.sort_by | default: collection.default_sort_by  }}">
              {% if section.settings.collection_sort_show_featured %}<option value="manual">{{ 'collections.sorting.featured' | t }}</option>{% endif %}
              <option value="best-selling">{{ 'collections.sorting.best_selling' | t }}</option>
              <option value="price-ascending">{{ 'collections.sorting.price_ascending' | t }}</option>
              <option value="price-descending">{{ 'collections.sorting.price_descending' | t }}</option>
              <option value="title-ascending">{{ 'collections.sorting.az' | t }}</option>
              <option value="title-descending">{{ 'collections.sorting.za' | t }}</option>
              <option value="created-ascending">{{ 'collections.sorting.date_ascending' | t }}</option>
              <option value="created-descending">{{ 'collections.sorting.date_descending' | t }}</option>
            </select>
          </span>

 

I am using the Canopy theme. 

 

Please help! 

 

Thanks,

 

Rozen

Replies 2 (2)

Rozen01
Visitor
2 0 0

Another thing that I am willing to settle for is ordering my collections based on the vendor name instead of the title of the product. I would there will be something somewhere defining these sorting options

Entaice
Pathfinder
121 7 36

Hi @Rozen01 - there's not a way to edit the sorting logic in the Shopify UI (!).  The best way to do what you're looking to do is to either rename the products or use the custom sorting feature within a collection.  If you're interested in maximizing sales, you can also look into collection sorting tools like ours. 

Hope this helps! 

You can increase your revenue by 5% by replacing Shopify's default sorts. Test for free. **Show me how**