Change Collection Sorting Default - Dawn Theme

Topic summary

Issue: User wants to change the default collection sorting from “Best Selling” to “Price: High to Low” for vendor pages that use the URL structure /collections/vendors?q=VendorName.

Context: The site has hundreds of vendors without dedicated collections. Clicking a vendor name generates dynamic pages, and the user wants these to default to price-descending sort.

Solution Process:

  • Initial suggestion was to append &sort_by=price-descending to collection URLs
  • Challenge: The code needed modification to handle both matched collections and dynamic vendor pages differently
  • The link_to_vendor Liquid filter was generating vendor URLs that needed the sort parameter added

Resolution: User successfully implemented the fix by modifying the Liquid template code:

{% else %}
<li class="vendor-list-item"><a href="/collections/vendors?q={{product_vendor}}{{link_to_vendor}}&sort_by=price-descending">{{ product_vendor }}</a></li>
{% endif %}

This appends the sort parameter specifically to dynamically-generated vendor pages while leaving collection-based vendor pages unchanged. An additional video tutorial about collection sorting was shared as reference.

Summarized with AI on October 26. AI used: claude-sonnet-4-5-20250929.

I am looking to make the default for all collections to be listed by Price: High to Low. The default now is set to Best Selling. I am looking to change the default code.

a little background: I have my site set up with a page that lists all my vendors. when the vendor name is clicked it goes to a page www.mysite.com/collections/vendors?q=VendorName

I want those pages to be listed by price High to Low.

Thank you for any help!

Just add this bit:

&sort_by=price-ascending

So the final link would be:

www.mysite.com/collections/vendors?q=VendorName&sort_by=price-ascending

thank you. the current code is:

    {% for product_vendor in shop.vendors %} {% assign its_a_match = false %} {% capture my_collection_handle %} {{ product_vendor | handleize | strip | escape }} {% endcapture %} {% assign my_collection_handle_stripped = my_collection_handle | strip | escape %}

    {% for collection in collections %}
    {% if my_collection_handle_stripped == collection.handle %}
    {% assign its_a_match = true %}
    {% endif %}
    {% endfor %}

    {% if its_a_match %}

  • {{ product_vendor }}
  • {% else %}
  • {{ product_vendor | link_to_vendor }}
  • {% endif %} {% endfor %}

where would I enter your extension?

I appreciate your help!

This bit:

{% if its_a_match %}
- {{ product_vendor }}

{% else %}
- {{ product_vendor | link_to_vendor }}

{% endif %}

Change to either this:

{% if its_a_match %}
- {{ product_vendor }}

{% else %}
- {{ product_vendor | link_to_vendor }}

{% endif %}

Or this:

{% if its_a_match %}
- {{ product_vendor }}

{% else %}
- {{ product_vendor | link_to_vendor }}

{% endif %}

Cant see what your product_vendor stores, meaning if its a ?q=VendorName or just a VendorName, so one of those variants will work.

neither seem to work. the current is www.mysite.com/collections/vendors?q=VendorName

I see what’s happening. this would work: &sort_by=price-descending but you have it adding to the actual collections not the vendors in which I do not have collections. for the vendors I have created collections for I can simply change it in the admin. since I have hundreds of vendors I have not created collection and in that case it it creating the page www.mysite.com/collections/vendors?q=VendorName

I was able to get it to work. For reference the code is:

{% if its_a_match %}

  • {{ product_vendor }}
  • {% else %}
  • {{ product_vendor }}
  • {% endif %} {% endfor %}

    Thank you for pointing me in the right direction!

    1 Like

    Here is the way you can try to use. I did that for best selling but you can change the code according to your requirement.

    Use below code: