Understanding merchandising expressions
Expressions are powerful rules that automatically sort products based on attributes like product type, vendor, price, or any other filterable attribute in your catalog.Expressions are applied after manual/conditional pins and before the primary sort order. This means pinned products always appear first, followed by products matching expressions, and finally all remaining products sorted by the base sort order.
How expressions work
- Dynamic Linking products appear first (if applied via Browse API on page 1)
- Manually pinned products appear next
- Products matching your expressions appear in the order of the expressions
- Within each expression group, products are sub-sorted by your selected base sort order
- Products not matching any expression follow at the end, sorted by the base sort order
Available operators
When building expressions, you can use various operators depending on the attribute type: Text operators:equals/does not equal- Exact match comparisoncontains/does not contain- Partial text matchingbegins with/does not begin with- Prefix matchingends with/does not end with- Suffix matchingin/not in- Match any value in a list (multi-select enabled in UI)is null/is not null- Check if attribute has a value (no value field shown in UI)
equals/does not equal- Exact numeric matchgreater than/greater than or equal- Value comparisonsless than/less than or equal- Value comparisonsbetween/not between- Range matching (requires two values)in/not in- Match any value in a list (multi-select enabled in UI)is null/is not null- Check if attribute has a value (no value field shown in UI)
equals/does not equal- Exact date matchafter/before- Date comparisonsbetween/not between- Date range matching (requires two values)is null/is not null- Check if attribute has a value (no value field shown in UI)
contains/does not contain- Check if tag existsin/not in- Match any tag in a list (multi-select enabled in UI)
When you select
is null or is not null operators, the value field is automatically hidden in the UI since these operators check for the presence or absence of data without requiring a comparison value.When to use null operators
Theis null and is not null operators are useful for filtering products based on whether an attribute has been set:
Example use cases:
vendor is not null- Only show products that have a vendor assignedcompare_at_price is null- Show products that are not on sale (no compare-at price set)metafield.custom.featured_until is not null- Show products with a featured end date configuredtags is null- Show untagged products that need categorization
Example use case
Let’s say you want to group products in your “New Shoes” collection by product type, while using the “Best-selling” sort order:- All Sneakers appear first, sub-sorted by best-selling rank
- Then all Sandals, sub-sorted by best-selling rank
- Then all Boots, sub-sorted by best-selling rank
- Finally, any remaining shoes (like Slippers or Loafers) sorted by best-selling rank