Work

/

About
Play
Blog
Contact
Home/Blog/Shopify
Shopify
•
Updated Oct 10, 2026
•
4 min read

Shopify Collection Sorting for Large Catalogs: Rank by What Actually Sells

Shopify Collection Sorting for Large Catalogs: Rank by What Actually Sells
MS
Muhammad Saad

Shopify engineer. I build storefronts, two published Shopify apps, and the infrastructure behind a 70,000+ product store, and I write here about what that work teaches me.

Follow on LinkedInSee my workBook a call
Found this useful? Share it.

Keep reading

Catalog import acceptance workflow: define scope, reconcile results, approve release
Shopify
•
6 min read

Shopify Product Imports: What to Check Before You Approve

Before approving a Shopify product import, check your descriptions, variants, images and unfinished items with this practical checklist for store owners.

Oct 16, 2026
Supplier and warehouse stock reconciliation organized into owners, snapshots, and discrepancy review
Shopify
•
7 min read

Shopify Stock Reconciliation: Suppliers and Your Warehouse

Reconcile Shopify supplier availability with your own warehouse stock using location ownership, inventory states, and a practical discrepancy review worksheet.

Oct 15, 2026
Inventory integration brief organized into supplier samples, ownership rules, and acceptance evidence
Shopify
•
6 min read

Shopify Inventory Integration: A Developer Brief

Prepare a Shopify inventory integration brief with supplier samples, stock ownership, acceptance criteria, and support responsibilities before hiring a developer.

Oct 13, 2026
Back to the blog

© 2026 Muhammad Saad • Colophon

Connect with me on LinkedIn

Elsewhere

  • Github
  • Testimonials
  • CV
  • LinkedIn

Contact

  • Contact details
  • Book a call
  • Email
  • Privacy policy
  • Editorial policy
On this page
  1. Why the Built-in Sort Orders Fall Short
  2. Slot One Gets Clicked Because It Is Slot One
  3. One View and One Order Is Not 100% Conversion
  4. Re-sorting Without Fighting the API
  5. Guardrails Before Anything Touches a Live Collection
  6. Build It or Install It?

Shopify gives every collection one sort order: best selling, price, newest, alphabetical, or manual. On a few hundred products that is fine. On a catalog of tens of thousands, the order of a collection decides which products get seen at all, and one signal is never enough.

Quick answer

Rank each product on a blend of recent revenue, conversion, margin and stock health. Correct click-through for the position a product was shown in. Pull products with little data toward the collection average. Then send Shopify only the moves that changed, preview them first, and keep a rollback.

Why the Built-in Sort Orders Fall Short

Best selling rewards what sold, not what is in stock in every size or what earns margin. Newest buries proven products under untested ones. Price says nothing about demand. Manual sorting is the only order that can weigh everything at once, and nobody can maintain it by hand across hundreds of collections.

Signals worth ranking on
SignalWhat it capturesWhat goes wrong without it
Recent revenueDemand that turns into money nowLast season's hero keeps the top slots
ConversionHow often a view becomes an orderPopular but unconvincing products crowd out buyers
MarginWhat each sale is worth to the businessDiscounted, low-margin items win every slot
Stock healthAvailability across sizes and variantsSold-out or broken size runs sit in prime positions
Position-adjusted click-throughShopper interest, corrected for placementWhatever is on top stays on top forever

Slot One Gets Clicked Because It Is Slot One

Click-through rate looks like the purest measure of interest, but it is biased by where a product appears. The first row of a collection gets far more attention than the fourth, whatever is in it. Feed raw click-through back into ranking and the products already on top earn the most clicks, which keeps them on top.

The fix is to compare each product's clicks with what an average product would have earned in the same positions. A product that beats its position is genuinely interesting; one that only matches it is just well placed. Shopify does not report per-position engagement for collections, so this needs your own tracking, usually a web pixel that records impressions and click positions.

One View and One Order Is Not 100% Conversion

On a large catalog most products have very little traffic. A product with one view and one order shows 100% conversion and would jump to position one. The standard remedy is shrinkage: blend each product's own rate with the collection average, weighted by how much evidence the product has.

Shrinking a sparse conversion rate toward the collection average
// k = how many views of evidence before a product's own rate dominates
const k = 50;

function shrunkConversion(orders, views, collectionRate) {
  return (orders + k * collectionRate) / (views + k);
}

shrunkConversion(1, 1, 0.02);      // ≈ 0.039, not 1.0
shrunkConversion(120, 2400, 0.02); // ≈ 0.049, close to its own 0.05

Re-sorting Without Fighting the API

Shopify reorders a manually sorted collection through the collectionReorderProducts mutation, which accepts up to 250 moves per call and returns a job that must finish before the next batch. Push the full order of a 5,000-product collection and that is twenty sequential round-trips. That cost is why many merchandising tools re-sort only once or twice a day.

Most re-sorts change only part of a collection. Products already in the right relative order can stay where they are, and the minimum number of moves is the collection size minus its longest increasing subsequence. On 57 real sort runs from a 47,000-product store, planning moves this way cut 84,916 moves to 22,299 and 382 API batches to 137.

Planning the minimum set of moves
// current: product ids in today's order; target: the new ranked order
const rank = new Map(target.map((id, i) => [id, i]));
const seq = current.map((id) => rank.get(id));

// Products on the longest increasing subsequence of seq already sit in the
// right relative order. Everything else gets one move to its target position.
const keep = new Set(longestIncreasingSubsequence(seq).map((i) => current[i]));
const moves = target
  .map((id, newPosition) => ({ id, newPosition }))
  .filter(({ id }) => !keep.has(id));

After the order changes, check that each card still displays the correct selected variant and price. The Shopify product-card checklist covers selection and cart feedback that should remain correct as products move.

Guardrails Before Anything Touches a Live Collection

  • Preview the exact moves and the signals behind each score before applying anything.
  • Snapshot the current order before every run, so any sort can be rolled back.
  • Abort a run that would reorder an unusual share of a collection. On the production runs above the median run moved 5.9% of a collection, so a 60% limit never fires on normal days but catches a half-synced data table.
  • Allow one writer per collection. Overlapping reorder batches can scramble the order.
  • Ingest catalog and order data with Bulk Operations, which do not drain the API rate limit the way paginated queries do on big stores.

Build It or Install It?

If your collections hold a few hundred products, the built-in sorts plus a few pinned products are often enough. Past a few thousand products per collection, or hundreds of collections, automation pays for itself. I built Swift AI Collections on exactly these ideas; the case study covers the details. If search is the bigger leak on your store, start with where Shopify search loses sales.

If your catalog is large and your collection pages feel stale, book a 30-minute call and we can look at your store together.