Skip to main content
You can create multiple merchandising rules targeting the same collection and sort order combination, so different rules can apply based on contextual conditions or time windows.

First-match-wins evaluation

When multiple rules target the same collection/sort combination, Layers uses a conditions-first evaluation order: rules with contextual conditions are always evaluated before the rule without conditions (the default/catch-all rule). A default rule never blocks a more specific conditional rule from matching, regardless of when each rule was created. Example scenario:
Even though the default rule was created first, Layers evaluates Rules 2 and 3 before Rule 1. A visitor from the US sees Rule 2, a UK visitor sees Rule 3, and all other visitors fall through to Rule 1.
You don’t set precedence between conditional rules. Conflict detection blocks conditional rules whose conditions could match the same visitor, and only one default rule can exist per collection and sort order, so at most one conditional rule and one default rule are ever candidates for a visitor. If two conditional rules both need to apply to some of the same visitors, narrow their conditions so they are mutually exclusive.

Conflict detection

To prevent conflicting merchandising rules, Layers checks for two kinds of conflicts as you edit and when you save:
  • Overlapping conditions — Your contextual conditions could match the same visitor as another rule targeting the same collection and sort order.
  • Duplicate default rule — Your rule has no contextual conditions, and a default rule already exists for the same collection and sort order. Only one default rule can exist per collection/sort combination.
Together, these checks keep only one rule matching a given visitor at any time.

Real-time conflict warnings

As you edit a rule in the merchandising sidebar, Layers checks for conflicts in real time. If your rule conflicts with an existing rule, a warning toast appears immediately, before you save. The warning identifies the conflicting rule by name and includes a View rule link so you can navigate directly to it. For an overlap conflict, adjust either rule’s conditions so they are mutually exclusive. For a default-rule conflict, add contextual conditions to your rule or edit the existing default rule instead. Real-time conflict warnings let you resolve conflicts while you work instead of discovering them when you save.

Save-time validation

When you save a rule, Layers performs a final conflict check. If the conflict still exists, Layers blocks the save and shows an error message that names the conflicting rule and includes a View rule link.

What constitutes overlapping conditions

Layers analyzes the contextual conditions of all existing rules for the same collection/sort combination and determines if the new rule’s conditions could match the same visitor as an existing rule. Non-overlapping conditions (allowed):
  • country == US and country == CA (different equality values)
  • country in [US, CA] and country in [UK, DE] (no common values)
  • source == klaviyo and source == google (different marketing sources)
Overlapping conditions (blocked):
  • country == US and country == US (identical conditions)
  • country in [US, CA] and country in [CA, UK] (common value: CA)
  • country == US and country in [US, CA] (US is in the list)
  • country == United States and country contains United (the exact value contains the substring)
  • country == United States and country begins with United (the exact value starts with the prefix)
  • country in [US, CA] and country contains C (a list value contains the substring)
Overlap detection uses heuristic analysis and may not catch all complex overlapping scenarios with deeply nested OR conditions. It is best-effort protection that still lets legitimate non-overlapping rules coexist.

See also