change default sort by value. -Spotlight theme

change default sort by value. -Spotlight theme

Nikxj44
Explorer
51 2 8

Hello, I want to change default sort by value, from "Alphabetically, A-Z" to -> "Date, new to old"

 

This is the page https://kartbagrationvalley.com/collections/all

 

Regards,

Replies 3 (3)

PaulNewton
Shopify Partner
7721 678 1625

Change the sort order of the collection itself is the simplest approach

https://help.shopify.com/en/manual/products/collections/collection-layout#change-the-sort-order-for-... 

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


Nikxj44
Explorer
51 2 8

I'm asking different question Paul, I know how to change sort order in "COLLECTIONS", I don't want that.

I'm asking to change sort orders on Products page. or T-shirts tab or Hoodies tab.

 

Default sorting value is sort alphabetically but I want to sort with date of creation. I know that I have to change some code but I'm unable to find it

PaulNewton
Shopify Partner
7721 678 1625

https://xyproblem.info/ ahead,

If you want to change the sequence/order of how sorting options are PRESENTED as  UI,

Most themes autogenerate the list so you have to make it manually with html/js as an advanced theme customization.

Copy out the existing html source (ctrl+u) , change the order of the elements in the html source code being copied and replace the template logic with that; the logic may or may not be similar to the reference implementation:

https://shopify.dev/docs/storefronts/themes/architecture/templates/collection#sort-products-in-a-col... 

💣With  "Alphabetically, A-Z" still being the default_sort_by  because that is collection datas default itself even if you force the UI to display something different.

 

If when a customer visits a frontend page you want to force products in a collections URL to be sorted in a specific way, regardless of the options chosen or instead of the actual default set in the collection admin , then it's advanced workarounds with the sort_by url parameter and redirects using javascript or meta directives, etc . See the parameters in the .dev docs or by navigating on the frontend with the sorting options to see the different url parameters.

Otherwise just use the collection-admin, or automations, to properly sort products in the first place.

 

 

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