Shopify Custom Ranking vs AI Collection Sort: How to Sort by Margin, Not Just Clicks
Key Takeaways
- Native AI Collection Sort orders products by predicted conversion probability. That is a strong default, but conversion is not the same as margin, sell-through, or inventory health.
- Conversion-optimized sort can quietly float your highest-converting, lowest-margin, discount-heavy products to the top, because a markdown converts.
- Margin and sell-through become sortable signals the moment you build them as metrics. You create margin as an imported metric off your Shopify financial data, then rank on it like any native signal.
- Governed custom ranking blends multiple signals into one normalized score you control: custom and imported metrics, weighted groups, soft boost, priority rules, and segmented sorting.
- Everything you weight is measurable. You can query the result in LayerSQL and prove the sort serves the business goal you set.
Six weeks reset how Shopify merchandising works, and most operators are still mid-scramble.
The old custom lever is gone, and native AI sort replaced it inside the same Edition.
Nobody has written down what that default actually optimizes for, where it stops, or what it quietly costs you on a margin-sensitive collection.
What just changed for Shopify sorting in mid-2026?
Shopify Scripts reached end of life on June 30, 2026, with no edits allowed since mid-April, and the Summer '26 Edition shipped native AI Collection Sort, which ranks products by predicted conversion probability.
It is a strong zero-config default. It does not optimize for contribution margin, sell-through, inventory health, or full-price protection.
That gap is where custom ranking still earns its place.
The timeline is tight. On June 30, every store running script-based sorting or ranking logic lost it, with no grace period.
Days earlier, the same Edition that retired the old lever shipped its replacement: native AI Collection Sort, plus predictive cross-sell blocks, a merchandising insights panel, and native A/B testing.
On paper the swap looks simple: custom logic retired, a capable default in its place.
For many collections that is genuinely fine, and rebuilding what native already handles would waste your time.
The gap shows up when your goal is not the click.
Native sort ranks for predicted conversion, so it delivers on click-through but was never built to hit a margin or inventory target, and that is the job custom ranking still does.
What does Shopify's native AI Collection Sort actually optimize for?
Native AI Collection Sort ranks each product by its predicted probability of converting for the current shopper.
Zero-config and a strong baseline, it optimizes for one outcome, the predicted click-to-purchase, using a single score you do not set or see.
It cannot weigh margin, inventory, or merchandising strategy, because none of those is its objective.
That objective is real and useful. It surfaces what is most likely to sell on this view.
For a brand with no margin or inventory target, a free default that works out of the box is close to the best option there is.
Sort order is not cosmetic, either. Baymard's product-list research found sorting to be a crucial part of how shoppers find and choose products.
It is one of the few list-page controls that measurably changes what people put in the cart.
Four traits define the kind of system it is:
- The objective is predicted conversion. Not realized margin, not units of overstock cleared, not exposure for new arrivals.
- It is zero-config, which is its strength. No setup, no maintenance, sensible out of the box.
- It is a single score by design, not a blend you can read or reweight. You do not set the weights, and you do not see the signals.
- It is one of several Summer '26 merchandising additions, so treat it as a strong baseline layer, not a ceiling.
High conversion is good for the click.
It is not automatically good for margin or inventory, and that difference is where conversion-optimized sort and your P&L start to diverge.
Is predicted conversion the same as your business goal?
No. Native AI Collection Sort optimizes for predicted conversion, which is not the same as your business goal.
A deep-discount product converts well because it is cheap, so a conversion sort can float your lowest-margin SKUs to the top while full-price sell-through slides.
Margin, overstock clearance, new-arrival exposure, and inventory health each need their own objective.
Conversion probability and contribution margin often point the same direction, which is what makes the gap easy to miss. The clearest place they split is discount drift.
A product on a deep markdown converts at a high rate precisely because it is cheap, so a conversion-optimized sort learns to float it up.
The shopper sees your most discounted, lowest-margin SKUs first and buys them. The model counts that as a win. Your blended margin and full-price sell-through quietly slide.
Stripe's commerce guidance makes the same point from the discounting side: predictable markdowns train shoppers to wait for the sale instead of buying at full price.
The same gap shows up across the goals a merchandiser actually carries.
- Contribution margin. Rank the profitable product up, not just the cheap one. A conversion sort cannot see margin, so it cannot favor it.
- Overstock sell-through. Clear the units you are long on. Overstock has no special standing in a conversion model unless it happens to convert well.
- New-arrival exposure. Surface launches before they have history. New arrivals have no conversion data, so a pure conversion sort buries them at launch, exactly when you need the exposure.
- Inventory health. Favor well-stocked products and demote near-sold-out where it matters. Invisible to an objective that only knows the click.
- Full-price protection. Keep markdowns from cannibalizing full-price demand. McKinsey's work on data-driven merchandising treats assortment and merchandising as a margin lever, not just a revenue one.
Excluding sale items is the blunt patch most teams reach for, and it fights the symptom instead of the cause.
The real fix is to sort on the objective you actually carry: build that objective as a metric, then rank on it.
How do you make margin a sortable signal on Shopify?
To rank a Shopify collection by margin, you build margin as an Imported (ShopifyQL) metric off your Shopify financial data, then sort on it.
The native metrics are behavioral and sales-side, so margin, which draws on cost data from your financials, comes in as an imported metric that refreshes on the schedule you set.
From then on, you sort, weight, and measure on it like any native signal.
The built-in performance metrics cover the behavioral and sales-side numbers. Margin is the exception, because it draws on cost data that lives in your Shopify financials.
You bring it in as an Imported (ShopifyQL) metric that runs full ShopifyQL against Shopify's authoritative financial data and refreshes hourly, daily, or weekly.
Once it exists, you rank on it exactly like any native one.
The two metric types are worth separating, because they draw on different data.
- LayerSQL metrics read behavioral data with a
FROM -> SHOW -> GROUP BY -> SINCEshape. The products dataset carriestotal_sales,quantity_purchased,view_sessions, andcart_sessions, plus dimensions likegeo_countryanddevice_type. - Imported (ShopifyQL) metrics read Shopify's authoritative sales and financial data, must include
product_id, and refresh hourly, daily, or weekly. This is where margin comes from.
Sell-through, full-price sell-through, and inventory-health scores work the same way. You define each one as a metric, then rank on it.
You wire margin in from your own financial data, so the sort serves the number you actually carry.
Standing it up takes a single query and a refresh schedule, not a custom integration or an engineering ticket.
What are the building blocks of governed custom ranking?
Governed custom ranking composes five visible levers you set yourself. Metrics define the objective, margin included.
Weighted groups blend several objectives into one normalized score, soft boost nudges a group up while keeping interleaving, and priority rules force hard top or bottom placement.
Segmented sorting adapts the order per visitor context. Every weight is yours, so the order stays transparent and tunable.
Governed ranking is not one feature. Our merchandising layer gives you a small set of levers you compose, and each one is visible.
Start with the metric, the objective you defined above. Then choose how it acts on the sort order.
- Custom and imported metrics are the objectives you rank on: native behavioral metrics, LayerSQL metrics, or Imported ShopifyQL metrics like margin.
- Weighted attribute groups blend several signals into one score. For each product, every feature's value is normalized to 0–1 across the current result set, signed by your "Higher is better" or "Lower is better" preference, multiplied by its weight, and summed into a single blended score. Weights rebalance to 100%, so "60% margin, 40% sell-through" means exactly that. This is the lever for ranking on more than one goal at once.
- Soft boost nudges a group of products up without hard grouping, keeping natural interleaving. Two modes: Amplify Strong Performers is multiplicative and lifts products that already perform, while Lift Matches Into View is additive and surfaces products toward a percentile target even at a zero base, built for new arrivals. Boost Strength runs 0–10 (default 0.25), Decay Rate defaults to 100, Percentile Target defaults to 50.
- Priority rules are hard overrides. Descending Promotes matching products to the top, ascending Demotes them to the bottom, and they take precedence over all other sort expressions. Use them for non-negotiables, like demoting
inventory_quantity equals 0or pinning a campaign. Soft demotion adds a relevance threshold so weak matches sink and strong ones hold, on active search surfaces, with a hard-demotion fallback in browse. - Segmented sorting makes one sort behave differently per visitor context. It blends segment and global values (
final_score = segment_value × segment_weight + global_value × global_weight, smoothing factor default 50) and supports conditional expressions keyed togeo.countrywith an unconditional fallback, so one sort can behave differently per market.
For the line between forcing a product to the top and nudging it there, our breakdown of when to pin and when to boost goes deeper.
Both levers, and the ranking rules that drive them, are things you read and set yourself.
Which custom ranking recipe matches your business goal?
To sort a Shopify collection by margin or sell-through, first build the objective as a metric (margin as an Imported ShopifyQL metric), then apply the right mechanic: a weighted group to blend margin with conversion, soft boost to surface overstock or new arrivals, and priority rules to force inventory non-negotiables.
Verify the result in LayerSQL. Each goal native sort cannot target maps to one composable mechanic.
Read the table, pick the goal you carry this quarter, and build that one.
| Business goal | Build the objective | Apply the mechanic | Verify the sort serves it |
|---|---|---|---|
| Contribution margin | Margin as an Imported (ShopifyQL) metric off Shopify financials | Weighted group: blend margin with conversion (e.g., 60% margin, 40% sales), "Higher is better" | Query margin-weighted top 20 vs conversion top 20 in LayerSQL; confirm blended margin rose without tanking conversion |
| Overstock sell-through | Sell-through as a LayerSQL or imported metric (units sold vs on hand) | Soft boost, Lift mode, on the overstock tag, so slow movers surface without a hard block | Check overstock SKUs moved up and units cleared week over week |
| New-arrival exposure | Native Published At or a freshness signal | Soft boost, Lift mode (additive), which surfaces zero-history items toward a percentile target | Confirm new arrivals appear in the first rows at launch, before conversion history exists |
| Inventory health | inventory_quantity and a stock-coverage metric | Priority rule (hard) to demote inventory_quantity equals 0; weighted group to favor well-stocked | Confirm out-of-stock sits at the bottom and near-sold-out is de-emphasized where intended |
| Full-price protection | Margin or full-price-sell-through metric | Weighted group plus soft demotion of deep-discount tags above a relevance threshold (search surfaces) | Confirm full-price SKUs hold their positions and markdowns no longer dominate row one |
Bring us a collection and a goal, and we will build the sort live.
Book a demo and we will configure the weighted group, the boost, or the priority rule against your own catalog on the call.
How do you prove the sort actually serves your business goal?
Because every signal you rank on is a metric you can query, you can prove the sort served the goal. Pull the top of the collection in LayerSQL.
Compare blended margin and conversion before and after, and confirm the trade you intended.
Native sort reports on the click; governed ranking lets you measure against margin, sell-through, or whatever objective you defined.
The read-back matters here because it closes the loop on the change you shipped.
After you ship a margin-weighted sort, you do not take it on faith.
You pull the top of the collection and compare blended margin and conversion, before and after, against the products dataset and the metrics you defined.
Native AI Collection Sort gives you an insights panel and native A/B testing. That is real signal, but it reports on the objective it owns, the click.
Governed ranking lets you measure against the objective you own, margin and sell-through included, because you defined them.
A couple of specifics make the read-back fast.
- The same LayerSQL metric powers both the dashboard and the ranking, so what you sort on is what you measure.
- Imported metrics refresh on the schedule you set, so the margin you measure is current to your chosen cadence.
The check is the difference between "the sort converts" and "the sort served the goal I set." Nielsen Norman Group found that visible control gives shoppers a feeling of choice.
The same holds for the merchandiser: a sort you can read and verify beats a score you have to trust.
When should you run native AI Collection Sort, and when do you add the layer?
Native AI Collection Sort is the right default when you want a strong, zero-config order and have no margin or inventory objective, especially across the long-tail collections nobody will hand-tune.
Add governed custom ranking where the sort must serve margin, sell-through, new-arrival exposure, or inventory health. Those goals need an objective native sort does not carry.
Native sort is the right call more often than the legacy search vendor ecosystem will admit.
If you have no margin or inventory objective and you want a sensible order with zero setup, native is excellent, and rebuilding it by hand would waste effort.
Across the long tail of collections nobody will ever hand-tune, it is the correct default.
And for stores still stabilizing after the Scripts end of life, it buys a working baseline immediately.
The layer earns its place exactly where the single objective stops.
When the sort has to serve contribution margin, clear specific overstock, expose launches before they have history, protect full-price demand, or behave differently by market, those are not click problems.
They are business-goal problems, and they need an objective you set and can measure.
We have watched this play out on real catalogs.
David Cost, VP of eCommerce at Rainbow Shops, saw conversion climb 30% once he finally had the control to build the sort orders his team needed.
That is a merchandising-control result: the same control that lets you wire margin or sell-through into the order once those become your objective.
Run native as the baseline. Add governed ranking where margin and inventory are on the line.
So which sort should you build first?
Native AI sort ranks for the click, and the click is worth ranking for.
But your quarter is measured in margin, sell-through, and inventory health, and a sort that cannot see those cannot serve them.
The mechanics exist. Import the metric, weight the goal, boost or pin the exceptions, and measure the result. The recipe sheet tells you which lever each goal needs.
Pick the goal you carry, and build that one.
FAQs
1. Does Shopify's AI Collection Sort consider margin? No. Native AI Collection Sort ranks products by predicted conversion probability, the predicted click-to-purchase for the current shopper. Margin is not part of that objective.
To sort by contribution margin, you build margin as an imported metric off your Shopify financial data, then rank on it as a signal alongside or instead of conversion.
2. How do I sort a Shopify collection by margin or sell-through? Build the objective as a metric first, then sort on it.
Margin comes in as an Imported (ShopifyQL) metric off Shopify's authoritative financial data; sell-through can be a LayerSQL or imported metric.
Then apply a weighted group to blend margin with conversion, or a soft boost to surface overstock, and verify the result in LayerSQL.
3. What replaced Shopify Scripts for sorting after the June 30, 2026 end of life? Shopify Scripts reached end of life on June 30, 2026, with editing disabled since mid-April.
For sorting and ranking, the replacement is a mix of native AI Collection Sort from the Summer '26 Edition for a zero-config baseline, and governed custom ranking when the sort must serve margin, sell-through, inventory health, or full-price protection.
4. Can I control how Shopify ranks products in search and collections? Yes.
Governed custom ranking exposes five levers you set yourself: custom and imported metrics, weighted attribute groups that blend signals into one normalized score, soft boost for gentle lifts, priority rules for hard top or bottom placement, and segmented sorting per visitor context.
Every weight is visible and tunable, unlike a single opaque score.
5. Is contribution margin a built-in metric for Shopify product sorting? The built-in metrics are behavioral and sales-side: sales, quantity, views, conversions, click-through rate, return rate, and velocity.
Margin draws on cost data from your Shopify financials, so you create it once as an Imported (ShopifyQL) metric that refreshes on your schedule.
From then on, you rank, weight, and measure on margin like any native signal.
6. How is custom ranking different from native AI Collection Sort? Native AI Collection Sort is a single predicted-conversion score you cannot decompose or reweight.
Governed custom ranking exposes every signal as a weight you set, an expression you read, and a metric you can query in LayerSQL.
Native optimizes for the click; governed ranking optimizes for the objective you define, including margin, sell-through, and inventory health.
7. How do I make sure a custom sort actually improves margin and not just conversion? Measure it.
Because every signal you rank on is a metric you can query, you pull the top of the collection in LayerSQL and compare blended margin and conversion before and after the change.
If blended margin rose without tanking conversion, the sort served the goal. That read-back is the check native opacity cannot give you.
Jake Casto · Founder, Layers
Jake Casto is the founder of Layers, the enterprise search and merchandising platform built for Shopify Plus. He previously co-founded Proton, a Shopify Plus engineering studio that shipped more than 400 storefronts, where Layers began as an internal tool for a problem that kept repeating. He writes about search infrastructure, performance, and the engineering behind discovery at scale.
Connect on LinkedIn