Sort collection products by metafield value

Sort collection products by metafield value

Invictusap
Visitor
3 0 0

I would like to know if there is an option to add a new sorting mode to my Shopify collections.


What I am looking for is to sort by an integer from 0 to 100 ascending or descending.


From what I could find out, there are some applications that allow this but I find that all of them modify the interface of my store, something I do not want.

 

I have tried to add the sorting options through code  plus javascript in my theme but they do not work. The only thing I managed to do is add the new options in the dropdown menu.

 

I recently tried to create a function in shopify functions but I still cannot get it to sort the products.

What alternatives do I have? Is there really an application that allows sorting by metafield values ​​that does not modify the interface?

Is this approach not correct?

Greetings,

Replies 2 (2)

PaulNewton
Shopify Partner
7201 637 1497

Hi @Invictusap 👋 there is not a native metafield sort order for collections, and shopify functions are primarily for the cart to checkout areas, a complete non starter for this need.

 

If you want to sort a manual collection in the backend that will in turn be sorted on the frontend,

You can use an app like mechanic to script bespoke sorting on manual collections

https://tasks.mechanic.dev/auto-create-collections-by-metafield-values 

 

If you need such automation customize then contact me by my email for services
Contact info in forum signature.
ALWAYS please provide context, examples: store url, theme name, post url(s) , or any further detail in ALL correspondence.

 

Good Hunting.

 

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


Invictusap
Visitor
3 0 0

I recently contacted you by email hoping to see if we can find a solution, as the Mechanic app does not allow the end customer to order products.

 

Regards,