
How to Sort Products in a Collection Using Custom Values with Mechanic
In this article, we'll introduce the collection sorting feature of Mechanic — an incredibly powerful app that enables all kinds of Shopify store automations through API integrations.
StoreHero leverages its proprietary growth platform to support business growth through granular operations that manual management can't achieve, along with the large-scale execution of growth initiatives. If you're struggling to increase sales on Shopify, feel free to reach out. =>Download our free service introduction guide here
Prerequisites
Since much of this article discusses product data, please refer to this documentation to understand what properties Shopify Product data contains.
Also, Shopify allows various types of data to carry something called a metafield. If you're unfamiliar with what metafields are, this page provides a detailed explanation.
Download the Guide to Building a High-Converting Store (Free)
About Collection Sorting
In Shopify, when sorting products on a collection page, the admin provides the following default options.

But what if, in addition to these options, you want to prioritize certain products? If you have a small number of products, you can manually reorder them using the manual sort option.
When You Have a Large Number of Products
What if you have 100 or more products? Manually rearranging them would be extremely time-consuming and tedious. That's where you can use the Mechanic task Auto-sort collections by product properties, with Mechanic to sort products in a custom way.
Steps Required
- Set the sort order of the collection you want to sort with a custom priority to "Manual"
- Edit the metafields for the products in that collection

- Metafields require a namespace, key, and value. For the namespace, use
globalif you want it to apply globally, or use thecollection nameif the priority is specific to that collection - There are no specific requirements for the key, but something descriptive like "priority" would be easy to understand
- Always enter a number for the value — use smaller numbers for higher priority items

Configuration in Mechanic
- Select the Auto-sort collections by product properties task
- Under "Product property lookups", specify the namespace and key of the metafield you set above

While we've been discussing sorting using metafields, you can also sort by other Product properties (such as published_at) instead of metafields. In that case, specifying a namespace and key is not required.
If the sorting doesn't apply to all collections, you can also specify which collections to sort here.

Once you click "Run task", you're done. You can verify that the sort was successful from the Shopify admin dashboard.
If you want the collection to be automatically re-sorted whenever new products are added, you can also configure options to auto-sort on an hourly or daily basis.
Maximizing App Usage with StoreHero
StoreHero supports merchants who want to increase sales on Shopify by executing growth initiatives thoroughly.
When it comes to app utilization, StoreHero integrates with apps for advertising, store management, CRM, and inventory — allowing you to perform fine-grained operations and execute large volumes of growth initiatives from the StoreHero growth platform, without having to operate each app individually.
We currently offer a free store diagnosis. If you have challenges with Shopify app utilization or growth strategies in general, please don't hesitate to contact us. Learn more about the free store diagnosis here
Summary
We've shown you how to use Mechanic to set a custom sort order for products within a collection. Mechanic is a versatile app that can implement a wide variety of automated processes through configuration alone. We hope you'll make the most of it.
StoreHero can support you from the ground up, starting with designing a high-converting store. Feel free to reach out. =>View StoreHero's Service Introduction Guide (Free)