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 @Lulu1
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
User | RANK |
---|---|
134 | |
98 | |
87 | |
62 | |
51 |
Connect your PayPal account to allow your customers to checkout using the PayPal gateway a...
ByYour online store speed can enhance your store’s discoverability, boost conversion rates a...
ByShopping is at our fingertips with mobile devices. Is your theme optimized to be user-frie...
By