Goal: enable sorting collection products by a metafield (custom product field) integer 0–100, ascending/descending, without altering the storefront UI.
Key points:
Attempts so far: theme code + JavaScript added new dropdown options but did not perform sorting; Shopify Functions tried, but they target cart/checkout and can’t solve collection sorting.
Platform limitation: no native Shopify option to sort collections by metafield values.
Proposed workaround: use the Mechanic app to script backend sorting for manual collections (pre-sorts the collection so the frontend reflects the order). A task link was shared.
Constraint noted: Mechanic does not provide customer-facing sorting controls; it only automates the order in the backend.
Status: unresolved. The OP has contacted the responder via email to explore a custom solution that would allow customer sorting by metafield without UI changes. No final decision or working implementation reported yet.
Summarized with AI on December 19.
AI used: gpt-5.
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?
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
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.
I just found a official document relates to your problem, it says you can change the sorting of a collection by changing the index of each products, hope it helps
Shopify doesn’t allow collections to be sorted by metafield values natively. Theme code, JavaScript and Shopify Functions can’t change collection order.
Realistic options are manual sorting with Shopify Flow, encoding values into sortable fields price or tags, using a background only sorting app or going headless with the Storefront API.