We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

I want to add a new sort option in the collections page sort by

I want to add a new sort option in the collections page sort by

aih_kimg
Shopify Partner
16 0 3

Hi,

 

I want to add a new option value from the Sort By dropdown. Then field is a custom metafield in Products named: custom.product_class. The values of this are: Premium and Regular.

aih_kimg_0-1750928992218.png

First step, I thought of adding the values first on the dropdown from en.default.schema.json.

aih_kimg_1-1750929183732.png


And also here on main-list-collections.liquid. But still it won't appear. I even tried editing the text of some existing options from the en.default.schema.json but it also wont appear.

aih_kimg_2-1750929257111.png

 

Is there way to do this? If you have other ideas?

Thank you.




 

Replies 2 (2)

Guleria
Shopify Partner
4299 825 1189

Hello @aih_kimg ,

 

Find this part of code, using DAWN it's in sections -> main-collection-product-grid.liquid

{%- for option in collection.sort_options -%}
                    <option
                      value="{{ option.value | escape }}"
                      {% if option.value == sort_by %}
                        selected="selected"
                      {% endif %}
                    >
                      {{ option.name | escape }}
                    </option>
                  {%- endfor -%}

And update it with this one

{%- for option in collection.sort_options -%}
                    <option
                      value="{{ option.value | escape }}"
                      {% if option.value == sort_by %}
                        selected="selected"
                      {% endif %}
                    >
                      {{ option.name | escape }}
                    </option>
{%- endfor -%}
<option value="Premium">
  Premium
</option>
<option value="Regular">
  Regular
</option>

 

 

Regards
Guleria

- Elevate Your Store with Expert Shopify Services. Email: guleriathakur43@gmail.com - Need a quick fix or a tailored customization? I’ve got you covered.
- Looking to enhance your pages? Try GEMPAGES- a powerful drag & drop page builder.
- Let’s make your store stand out. Get in touch today!
- My Apps: Productify Groups – Smart product grouping made easy.

PaulNewton
Shopify Partner
8031 686 1646

@aih_kimg adding arbitrary html doesn't create a sort algorithm.

Generally apps are need to add a custom sort to a storefront.

 

Contact paull.newton+shopifyforum@gmail.com for the solutions you need


Save time & money ,Ask Questions The Smart Way


Problem Solved? ✔Accept and Like solutions to help future merchants

Answers powered by coffee Thank Paul with a Coffee for more answers or donate to eff.org