Skip to main content

What diversity does

A diversity expression limits how many products from the same product family are allowed in the top K positions of a sort order or merchandising rule. Instead of the first page showing six near-duplicates of the same style in a row, diversity spreads the assortment so more distinct styles are visible before a customer has to scroll. Diversity acts on the top window only. Beyond the window, products fall back to their natural sort order and duplicate families are allowed again.
Diversity requires at least one product family to be configured. Without families, diversity has nothing to group by and will have no effect.

When to use diversity

Use diversity when your catalog contains many variations of the same underlying style and the first page of a collection feels repetitive. Common scenarios:
  • A best-selling t-shirt is available in eight colors and all eight dominate the top of the collection.
  • A top-ranked furniture piece ships in five fabrics and pushes every other product off page one.
  • A vendor has multiple near-identical SKUs that all score similarly on your sort order.

How diversity fits with other sort features

Diversity layers on top of your base sort order and respects higher-priority controls:
  1. Pins (merchandised or dynamic) stay in their pinned position and count toward the cap — a pinned family member reserves a slot under the per-family limit.
  2. Priority rules (promote/demote) apply first, producing a preliminary ordering.
  3. Diversity reshuffles within the top window to enforce the per-family cap and the coverage floor.
  4. Soft boost, metrics, and attributes continue to determine ordering within the window.

Configuration parameters

You configure diversity as an expression in two places:
  • In a sort order, as a sorting attribute of type Diversity.
  • In a merchandising rule, as an expression of type Diversity.
The UI exposes the same fields in both locations.

Window size

The number of top positions where the cap and coverage rules apply. Beyond this window, natural sort order resumes and repeats are allowed.
  • Range: 1 to 200
  • Default: 20
  • Guidance: Match the window to the first page of your collection grid. If your storefront shows 24 products per page, a window of 24 is a reasonable starting point.

Max per family

The maximum number of products from the same family allowed inside the window.
  • Range: 1 to 100
  • Default: 2
  • Guidance: Start at 2. Raise the cap when a family has many distinct variants you want surfaced, lower it when you want maximum variety.

Minimum unique families

A coverage floor. If fewer than this many distinct families appear in the window after the cap is applied, the top-scoring first-occurrence of each missing family is promoted up to fill the gap.
  • Range: 0 to 200
  • Default: 0 (coverage disabled)
  • Guidance: Use when you want to guarantee a minimum breadth on the first page — for example, “I want at least 10 different styles in the top 20.”

Products without a family

Controls how products that have no family assignment are treated inside the window.
  • Treat each as its own family (recommended) — Every unassigned product counts as a singleton family. It never trips the per-family cap and each one counts toward the coverage floor. This is the default.
  • Exempt from diversity entirely — Unassigned products bypass the cap and do not count toward coverage. They keep their natural sort position within the window.

Examples

Cap color variants on a best-seller collection

A “Best Sellers” collection keeps surfacing the same hoodie in every color. You want at most two variants of any one style in the top 20. Settings
  • Window size: 20
  • Max per family: 2
  • Minimum unique families: 0
  • Products without a family: Treat each as its own family
Result: At most two products from any single family (for example, the hoodie) appear in the first 20 positions. The third-best-selling color drops out of the top window and re-enters below it. Products without a family are unaffected.

Guarantee at least 10 distinct styles in the top 20

You want the first page of a seasonal collection to always feel broad, even if a handful of styles outperform everyone else. Settings
  • Window size: 20
  • Max per family: 2
  • Minimum unique families: 10
Result: After the per-family cap is applied, if the top 20 contains fewer than 10 distinct families, Layers promotes the highest-scoring first-occurrence of each missing family up into the window until the floor is met.

Brand-level diversity

You use a manual family to group everything from a single private-label brand so it cannot dominate the top window. Settings
  • Window size: 24
  • Max per family: 3
  • Minimum unique families: 0
Result: No more than three products from the grouped brand appear in the first 24 positions.

Best practices

  • Start with defaults. A window of 20 and a cap of 2 works well for most apparel and home collections.
  • Preview every change. Diversity noticeably reshuffles the first page — always use the sort order preview or merchandising rule preview before saving.
  • Check family coverage first. Diversity has no effect on products that aren’t assigned to a family. Before tuning, confirm that your families cover the products you care about.
  • Use coverage sparingly. A high coverage floor can push weak matches into the top window. Raise it gradually and verify the preview still looks right.
  • Combine with priority rules, not against them. A priority rule and a diversity expression in the same sort order can compose well — promote a brand with a priority rule, then cap variants with diversity.

See also