Hello,
I’m using the Showcase theme (latest version) and I’m trying to edit what options are shown in the Sort By filtering. Currently the options that show are:
Sort by
-
Best selling
-
Alphabetically, A-Z
-
Alphabetically, Z-A
-
Price, low to high
-
Price, high to low
-
Date, old to new
-
Date, new to old
However I would like to change them to:
- Price, low to high
- Price, high to low
- New
How can i change this in this theme?
Looking at the theme code, I can see that in main-collection.liquid, there is this line:
assign current_sort_by = collection.sort_by | default: collection.default_sort_by
I assume I would need to replace default: collection.default_sort_by to something specific?
Thanks so much for your help!
Hi @Jenny-Arena
Thanks for this but it doesn’t seem to match up for the Showcase theme.
I don’t have a collection-template.liquid file but it looks like i would need to edit the main-collection.liquid file.
Within this file the only mention of “sort” is in these lines:
{%- liquid
if collection.url.size == 0
assign results_url = routes.all_products_collection_url
else
assign results_url = collection.url
endif
if results_url contains "?"
assign results_url = results_url | split: "?" | first
endif
assign current_sort_by = collection.sort_by | default: collection.default_sort_by
-%}
Therefore im not sure which line i need to edit to get it to look like:
{% for option in collection.sort_options %}
**{% unless option.value contains 'title-ascending' or option.value contains** '**title-descending**' **%}**
<option value="{{ option.value }}"{% if sort_by == option.value %} selected="selected"{% endif %}>{{ option.name }}</option>
**{% endunless %}**
{% endfor %}
do you have any ideas for this?
Thanks