Conditional sort expressions are in Beta. The behavior and UI may still evolve based on merchant feedback.
Overview
A conditional sort expression is any value sort term — a metric, an attribute, or a weighted group — with an Only when… condition attached. Products that satisfy the condition are ranked by the term as usual. Products that fail the condition are treated as having no value for that term and fall through to the next expression in the sort group. This lets you rank on a signal only for the products where the signal is reliable, without hiding the rest of the catalog or writing a custom formula.When to use it
Use an Only when… condition when a sort signal is only meaningful for part of the catalog:- Confidence tiers on sparse metrics. Sort by conversion rate only for products with enough orders to trust the number. Everything else falls through to a broader signal like views or overall sales.
- Stacked tiers without a custom column. Chain two or more conditional terms to build tiered ranking — top tier ranks by a strict signal, next tier by a looser signal — without introducing a computed attribute just to hold the tier key.
- Attribute-scoped sorts. Sort by a metafield or attribute that only some products carry (for example,
metafield.custom.editor_score), letting unscored products slot in beneath scored ones instead of ranking as if they were zero.
Only when… is per-product; Conditions is per-request.
How the fall-through works
Each sort term contributes one ranking position. When a product fails anOnly when… condition, the term yields no value for that product, so the product ties with every other failing product on that term. The next term below then breaks the tie.
Consider a sort order with two terms:
- Products with 25+ orders in the last 30 days are ranked by conversion rate first, then by views as a tiebreaker.
- Products with fewer than 25 orders all tie on the first term and are ranked by views.
Where the condition applies
Only when… is available on value sort terms:
- Simple attribute and metric expressions
- Weighted groups (gates the whole blended score)
- Soft boost already supports its own per-product condition — see that page for details
Only when… does not apply to priority rules. Priority rules already use a condition to decide who gets promoted or demoted, so a second gate would be redundant.
Configure an Only when condition
- Open a sort order and expand the expression card you want to gate.
- Open the expression’s settings and enable Only when….
- Add one or more rules. Each rule references a product field — either a metric or a product attribute — with an operator and a value.
- Use the group combinator (AND / OR) to combine multiple rules.
- Save and preview the sort order to confirm the fall-through order is what you expect.
greater than, between), text matches, null checks (is null / is not null), and list operators (in / not in).
Examples
Rank by conversion rate only for products with enough orders
Stack confidence tiers
Rank by a metafield only when it’s set
Best practices
- Preview after adding. Fall-through order is easy to reason about once you see it laid out — preview the sort order with sort effect annotations to confirm which term each product ranked on.
- Keep conditions simple. One or two rules per term is usually enough. Complex nested conditions become hard to reason about later.
- Prefer a threshold over
is not nullfor metrics. Metric values default to zero when there’s no data, so gate them with a numeric threshold (orders ≥ 25) rather than a null check. - Order matters. Put the strictest gated term first and the fallback term last. The pipeline reads top-down; each falling-through cohort meets the next term in turn.