Shopify themes, liquid, logos, and UX
Hi. I'm currently using Narrative theme and I want to delete some sorting options and customise some of them. But I'm struggle to find the bit of code for that.
Thanks you in advandce.
My site is https://warmderland.myshopify.com/ .The password is bukrao
Solved! Go to the solution
This is an accepted solution.
Hi @Warmderlend
In this theme we have no option to customize this short option as its generating by shopify.
But we can do some custom code to remove some option. like this
1. Open Section->collection-template.liquid and then find 'collection.sort_options'
Now add unless condition like below so they can remove added option from box.
{% 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 %}
So here they remove 'Alphabetically, A-Z' and Alphabetically, Z-A option.
You have to add condition in below line more if you want to hide option
{% unless option.value contains 'title-ascending' or option.value contains 'title-descending' %}
You can use following option in condition:
1. manual
2. best-selling
3. title-ascending
4. title-descending
5. price-ascending
6. price-descending
7. created-ascending
8. created-descending
This is an accepted solution.
If you want to add custom option then we have total this option:
<select name="sort_by" id="SortBy" aria-describedby="a11y-refresh-page-message" class="collection-sort__input"> <option value="manual">Featured</option> <option value="best-selling" selected="selected">Best selling</option> <option value="title-ascending">Alphabetically, A-Z</option> <option value="title-descending">Alphabetically, Z-A</option> <option value="price-ascending">Price, low to high</option> <option value="price-descending">Price, high to low</option> <option value="created-ascending">Date, old to new</option> <option value="created-descending">Date, new to old</option> </select>
Remove below code and add this above code:
<select name="sort_by" id="SortBy" aria-describedby="a11y-refresh-page-message" class="collection-sort__input"> {% for option in collection.sort_options %} <option value="{{ option.value }}"{% if sort_by == option.value %} selected="selected"{% endif %}>{{ option.name }}</option> {% endfor %} </select>
In this you can change text of this option as you want but cant change value
This is an accepted solution.
Hi @Warmderlend
In this theme we have no option to customize this short option as its generating by shopify.
But we can do some custom code to remove some option. like this
1. Open Section->collection-template.liquid and then find 'collection.sort_options'
Now add unless condition like below so they can remove added option from box.
{% 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 %}
So here they remove 'Alphabetically, A-Z' and Alphabetically, Z-A option.
You have to add condition in below line more if you want to hide option
{% unless option.value contains 'title-ascending' or option.value contains 'title-descending' %}
You can use following option in condition:
1. manual
2. best-selling
3. title-ascending
4. title-descending
5. price-ascending
6. price-descending
7. created-ascending
8. created-descending
Thank you so so much.
But is there a way I can change the name like "Date, new to old" to "New Arrival"? or it's just like that ?
No because this all option generate by shopify, if you want to add your custom option only then you have to create i by custom code. and remove shopify code.
This is an accepted solution.
If you want to add custom option then we have total this option:
<select name="sort_by" id="SortBy" aria-describedby="a11y-refresh-page-message" class="collection-sort__input"> <option value="manual">Featured</option> <option value="best-selling" selected="selected">Best selling</option> <option value="title-ascending">Alphabetically, A-Z</option> <option value="title-descending">Alphabetically, Z-A</option> <option value="price-ascending">Price, low to high</option> <option value="price-descending">Price, high to low</option> <option value="created-ascending">Date, old to new</option> <option value="created-descending">Date, new to old</option> </select>
Remove below code and add this above code:
<select name="sort_by" id="SortBy" aria-describedby="a11y-refresh-page-message" class="collection-sort__input"> {% for option in collection.sort_options %} <option value="{{ option.value }}"{% if sort_by == option.value %} selected="selected"{% endif %}>{{ option.name }}</option> {% endfor %} </select>
In this you can change text of this option as you want but cant change value
Thanks for the above @Jasoliya
Is there a way to ADD a sort option?
As several people have noted elsewhere 'Sort by' : Date, old to new, or Date, new to old
use the date-time the Product was added to the database - and unless products are added in the right sequence when first creating the store, there seems no way of altering/correctling it subsequently.
The best alternative for us would be to replace these two sorts with their 'Sort by' : SKU equivalents
- as (in our case) low skus are older than higher skus.
No we cant add short option, you can add filter for that but not under short box
Looks like a solution/workaround to sorting by (created!)Date is here:
https://community.shopify.com/c/shopify-design/collection-sorted-by-publish-date/m-p/1321205#M344952
Thanks to @Itai-Koren
This solution worked for a full width website.
Unfortunately, the mobile version of the dawn theme still shows all the sort options. What am I missing?
hey im having the same issue but for dawn 2.0
is there a way i can edit the order of the sort list (and what comes up first when page is loaded)
and also remove some of these too?
thank you
Hi,
Thank you so much for this it really worked for my website. I searched a lot of queries for this.
But my only problem is that it's not working on the mobile. Since the mobile code is different.
I am pasting it here for your reference. Let me know if you have a solution for this.
The sort by option is combined within my filter option in mobile view using the code below. is there anyway I can separate filter and sort by just like my desktop screen view.
<div class="filter-container filter-container--side{% if section.settings.collapse_tag_sidebar_by_default == false %} filter-container--show-filters-desktop{% endif %}" data-ajax-container>
{% if section.settings.coll_show_sort or show_filters %}
{% render 'faceted-filters', filter_context: collection, clear_url: collection.url, current_sort: current_sort %}
{% endif %}
Hi Jasoliya,
Can you help us set the custom default sort type, so all out of stock products push to the end of the collection list?
This is not support to wok with css for that need custom liquid code based on theme
best regard
Yes, that's what I meant, to hire you for this task.
But we already fixed this task with other developer.
Thank you.
Hi @Jasoliya ,
can you help me how can I arrange the sorting of my custom code sort? My developer is mot responding to me. I want all new products to be on the ‘This season first’ sort
OK send me your store url i will check
Best regard
Is it also possible to make the new products in alphabetical order?
If you just want to make collection page in any default shorting then you can do from admin direct
open collection in admin and change shorting as per image
How to translate this dropdown text into japanease. my website is https://socialbuzzoid.com
For that need to custom code it,
this is english version, that you can translate and replace on exiting place
<select name="sort_by" id="SortBy" aria-describedby="a11y-refresh-page-message" class="collection-sort__input">
<option value="manual">Featured</option>
<option value="best-selling" selected="selected">Best selling</option>
<option value="title-ascending">Alphabetically, A-Z</option>
<option value="title-descending">Alphabetically, Z-A</option>
<option value="price-ascending">Price, low to high</option>
<option value="price-descending">Price, high to low</option>
<option value="created-ascending">Date, old to new</option>
<option value="created-descending">Date, new to old</option>
</select>
Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024