NEWSLayers closes first external funding round led by LOI VentureRead more
‹ All Articles

How to Sort Products by Margin Without Sacrificing Discovery

Jake Casto11 min read

The default sort order on most Shopify Plus stores optimizes for conversion. That sounds right until you look at which products are converting.

A $15 clearance tee at 8% conversion rate outranks a $120 jacket at 2% conversion, even when the jacket carries 60% margin. Best-selling sort doesn't care about your P&L. It cares about units moved.

This is a profit leak hiding inside your collection pages.

If you flip to margin-only sorting, you bury the products shoppers came to find. Discovery collapses. Bounce rate climbs. You've traded one problem for another.

The fix is a weighted approach: margin as one signal among several, tuned to your catalog and measured against real outcomes.

This article covers when margin sorting helps, when it backfires, and how to build a formula that improves your bottom line without wrecking the shopping experience.

For the technical implementation (weighted groups, computed attributes, sort recipes), read our companion guide: How to build custom ranking on Shopify Plus.

Key takeaways

  • Best-selling sort ranks by units or revenue, not profit. High-converting clearance items consistently outrank higher-margin products.
  • Margin-only sorting buries what shoppers want to find. The fix is a weighted composite: margin alongside conversion rate, sell-through, and inventory age.
  • Start with a 10-15% margin weight on your top three collections. Measure gross profit per page view for two weeks before expanding.
  • Three warning signs that margin sorting has gone too far: CTR drops below your baseline, on-site search spikes for products that should be visible, and bounce rate climbs on affected collections.

Why does "best selling" sorting leave money on the table?

Best-selling sort ranks products by units sold or gross revenue over a rolling window, typically 7 or 30 days. It rewards volume. It does not distinguish between a $15 sale at 8% margin and a $120 sale at 60% margin. Three mechanisms make this costly at scale.

  1. Volume bias buries high-margin products. Your clearance items convert at higher rates because the price barrier is low. They climb to the top of every collection page, pushing full-price inventory below the fold. The products making you the most money per unit? Gone.

  2. Discount drift compounds over time. Stripe's research on ecommerce pricing shows that predictable markdowns train shoppers to wait for sales. When discounted products dominate your sort order, you signal that discounts are the norm. Full-price sell-through drops. Your margin structure erodes from both ends.

  3. Revenue-per-session masks the problem. Total revenue can climb while contribution margin falls. If your top 20 products by unit volume carry an average margin of 12%, but your top 20 by margin carry 55%, best-selling sort is actively hiding your most profitable inventory.

We see this pattern on almost every Shopify Plus store running default sort logic. The gap between conversion-optimal and margin-optimal sort orders is where the money hides.

The sort isn't broken. It was never designed to factor in profitability.

For a deeper look at why Shopify's native AI Collection Sort optimizes for predicted conversion rather than your business goal, see our custom ranking guide.

What is margin-aware sorting and how does it differ from margin-only sorting?

Margin-aware sorting treats profitability as one weighted signal inside a composite ranking formula. It lifts higher-margin products in the order without burying the products that drive traffic and conversion.

Pure margin-only sorting is the opposite extreme. It ranks every product strictly by gross margin percentage, regardless of whether anyone wants to buy it.

Think of it as a spectrum.

On one end: pure conversion sorting. Best-selling, highest click-through, most units moved. On the other end: pure margin sorting. The highest-margin product sits at position one no matter what.

Neither extreme works. The first ignores profitability. The second ignores shoppers.

Margin-aware sorting lives in the middle. You assign margin a weight, and that weight determines how much influence it has relative to other signals.

Three strategies for incorporating margin

Gentle boost. Give margin a 10-15% weight in your sort formula. This nudges higher-margin products up a few positions without dramatically reshuffling the page. Lowest risk, easiest to measure, and a good starting point.

Composite score. Build a multi-signal formula where margin carries 30-40% of the total weight, balanced against sell-through, conversion rate, and inventory age. This requires more tuning but produces a sort order that reflects your actual business priorities.

Segment-specific rules. Apply different margin weights by collection, traffic source, or shopper segment. A "New Arrivals" collection might weight margin at 10%, while a "Best Sellers" collection weights it at 30%. This is the most precise approach, and it's where segmented sorting with weighted groups earns its keep.

What does a margin-weighted sort formula look like in practice?

A margin-weighted formula normalizes each signal to a 0-1 range, multiplies by a percentage weight, and sums the results into a composite score. We handle the normalization and scoring automatically through weighted groups, which rebalance weights to sum to 100% whenever you adjust one slider.

Here are three worked examples using real numbers from a mid-size apparel catalog.

Example 1: Gentle margin boost (85% revenue, 15% margin)

Product7-Day RevenueMargin %Revenue ScoreMargin ScoreWeighted Score
Clearance Tee$4,20012%0.950.200.84
Silk Dress$2,90062%0.661.000.71
Linen Blazer$1,80058%0.410.970.49

Even at 15% weight, margin reshuffles the middle of the order. The clearance tee still leads because its revenue dominance is too strong, but the silk dress jumps ahead of the linen blazer.

Example 2: Balanced composite (40% revenue, 35% margin, 25% sell-through)

ProductRevenueMarginSell-ThroughComposite
Silk Dress0.661.000.450.73
Linen Blazer0.410.970.700.68
Clearance Tee0.950.200.880.67

At 35% margin weight, the silk dress overtakes the clearance tee. The sort order now reflects profitability and demand together. This is the configuration most merchandising teams settle on after testing.

Example 3: Aggressive margin-first (60% margin, 40% revenue)

ProductMarginRevenueComposite
Silk Dress1.000.660.86
Linen Blazer0.970.410.75
Clearance Tee0.200.950.50

The clearance tee drops to last. Shoppers who came for it won't find it above the fold. Use this only on collections where margin is explicitly the priority and traffic intent aligns with that goal.

To make margin a sortable signal, you need it as a computed attribute or an imported metric from your Shopify financials. Our companion guide covers the implementation step by step.

When does margin sorting hurt discovery (and how do you detect it)?

Margin sorting hurts discovery when it pushes products below the fold that shoppers expect to find. The risk scales with how aggressively you weight margin relative to demand signals. Three warning signs tell you the balance has tipped too far.

  1. Click-through rate drops on affected collections. If you weighted margin at 30% on Tuesday and CTR on that collection falls 15% by Thursday, shoppers aren't finding what they want above the fold. Track this in your analytics dashboard with period-over-period comparison.

  2. On-site search spikes for products that should be visible. When a product drops from position 3 to position 18, shoppers who expected it resort to the search bar.

A sudden increase in queries for products you stock and sell is the same signal pattern we describe in our guide to zero-result queries. The collection page isn't doing its job.

Baymard's ecommerce UX research found that 56% of sites have mediocre-or-worse search UX. A sort-order failure turns your search bar into a coping mechanism rather than a feature.

  1. Bounce rate climbs on collection pages. If shoppers land on a collection and immediately leave, the sort order isn't matching their intent. This is especially telling when the bounce increase correlates with a margin-weight change.

Sort order isn't the only way products get hidden. Combined listing configurations can cause similar discovery gaps through a completely different mechanism.

The "would a customer notice?" test. Before you adjust margin weight, look at the sort preview and ask one question: would a shopper landing on this page think the products look wrong?

If your best sellers disappeared below the fold, the answer is yes.

Google Cloud's retail research found that 80% of shoppers leave and buy elsewhere after a failed product discovery experience. A confused shopper doesn't convert at all, regardless of what the margin math says.

Baymard Institute's product sorting research confirms that shoppers form expectations about sort order within the first 3-4 products they see. Violate those expectations and exit rates climb 20-30%.

How do you blend margin with sell-through and conversion rate?

The most effective margin-aware formula blends four signals, each weighted by its strategic importance to your business. We recommend this composite as a starting point.

We've tested variations of this formula across dozens of Shopify Plus catalogs ranging from 500 to 50,000 SKUs. The weights below are where most merchandising teams land after two to three iterations.

Composite formula:

Score = (margin x 0.4) + (sell-through x 0.3) + (CVR x 0.2) + (1/inventory_days x 0.1)

Each signal does specific work.

  • Margin (40%). The profitability lever. Pushes higher-margin products up.
  • Sell-through rate (30%). Rewards products that move relative to stock. Prevents slow-moving high-margin items from camping at the top indefinitely.
  • Conversion rate (20%). Preserves demand signal. Products shoppers want to buy stay visible.
  • Inverse inventory days (10%). A gentle nudge for fresh inventory. Products sitting in stock for 90 days get a small penalty relative to last week's arrivals.

You set these weights inside a weighted group. We normalize each signal to a 0-1 range, so a 58% margin and a 4.2% conversion rate become comparable in the formula.

The weights above aren't sacred. McKinsey's research on data-driven merchandising shows that the retailers who outperform on margin do so by testing weight combinations against real outcomes, not by picking weights once and walking away.

Adjust for your catalog:

  • Heavy on seasonal inventory? Increase sell-through to 40%, reduce margin to 30%. You need to move product before markdown.
  • Mostly full-price with stable margins? Reduce sell-through to 20%, raise margin to 50%.
  • Running a clearance event? Flip it entirely: sell-through at 50%, inventory days at 30%, margin at 20%.

David Cost, VP of eCommerce at Rainbow Shops, saw a 30% conversion lift after implementing weighted custom ranking. The key, he said, was that weighted groups made every signal "visible and tunable," unlike a single opaque best-selling score.

How do you measure whether margin-aware sorting improved your bottom line?

Run a before/after comparison using gross profit per page view as the primary metric. This single number captures whether the sort change moved profit or merely rearranged the page.

The methodology:

  1. Record two weeks of baseline data on each collection you plan to change. Capture total gross profit, total page views, and the resulting gross profit per page view.

  2. Apply your margin-weighted sort. Let it run for two full weeks without other changes. Same ad spend, same promotions, same inventory mix.

  3. Compare gross profit per page view, period over period. You can run this comparison in your analytics dashboard or query the underlying data through LayersQL.

What to watch for:

  • Gross profit per page view up, CVR stable. The formula is working. Shoppers are buying, and the products they buy are more profitable. Keep the weights.
  • Gross profit per page view up, CVR down slightly. Acceptable if the profit gain exceeds the conversion loss. Do the math in absolute dollars, not percentages.
  • Gross profit per page view flat, CVR down. The margin weight is too aggressive. Reduce by 5-10 percentage points and retest.
  • Gross profit per page view down. Roll back. Your catalog likely has a tight correlation between demand and margin, meaning your high-margin products are already your best sellers. That's a good problem to have.

Start with a gentle boost, measure for two weeks, then decide

Pick your three highest-traffic collections. Add margin as a computed attribute if you haven't already. Set a weighted group with margin at 10-15%, balanced against your current revenue sort at 85-90%.

Preview the sort order before publishing. Check whether the top 8 products still make sense to a shopper landing on that page. If they do, publish.

If your best sellers vanished below the fold, reduce margin weight to 5% and try again.

Measure for two weeks. Look at gross profit per page view, CTR, and bounce rate. If the numbers improve, increase margin weight by another 5-10% and repeat.

This isn't a set-and-forget decision. The right margin weight changes with your inventory, your seasonality, and your promotional calendar. The retailers who get the most from margin-aware sorting, per McKinsey, are the ones who revisit the formula quarterly.

If you're sorting by best-selling alone today, even a 10% margin weight is a meaningful step toward aligning your collection pages with your P&L.

The products at the top of the page should be the ones that build your business. Volume is a signal, not the goal.

For the full technical walkthrough of setting up computed attributes, weighted groups, and sort recipes, read How to build custom ranking on Shopify Plus.

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