Sort Search Result by Newest First

Highlighted
New Member
3 0 0

Hello,

I want to sort search result by newest first but on https://docs.shopify.com/themes/liquid/filters/array-filters#sort it shows only price title options here.In array {% assign foo = search.results | sort:'date' %} Using date is not working. 

Can anyone please let me know how to do this?

- Adam

0 Likes
Highlighted
New Member
3 0 0

Hey Adam, 

Try using "created_at" or "updated_at":

{% assign foo = search.results | sort:'created_at' %} 

A complete list of parameters would indeed be usefull tho...

Cheers,

Marius

0 Likes
Highlighted

It seems like the sort filter on search results simply doesn't work. Seems like a liquid flaw.

0 Likes
Highlighted
New Member
4 0 0

Did you ever sorted this?

 

I seem to be having same issues, as soon as I add the sort: parameter to search.results I have 0 results

0 Likes