First-match-wins evaluation
When multiple rules target the same collection/sort combination, the system uses a conditions-first evaluation order: rules with contextual conditions are always evaluated before rules without conditions (default/catch-all rules). Among rules of the same type, evaluation follows creation order. This means a default rule will never block a more specific conditional rule from matching, regardless of when each rule was created. Example scenario:Among rules that all have contextual conditions, evaluation follows creation order. The same applies among default rules. If you need to change precedence between rules of the same type, recreate them in the desired order.
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.
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. This lets you resolve conflicts while you work, rather than discovering them only when you attempt to 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
The system 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 == USandcountry == CA(different equality values)country in [US, CA]andcountry in [UK, DE](no common values)source == klaviyoandsource == google(different marketing sources)
country == USandcountry == US(identical conditions)country in [US, CA]andcountry in [CA, UK](common value: CA)country == USandcountry in [US, CA](US is in the list)country == United Statesandcountry contains United(the exact value contains the substring)country == United Statesandcountry begins with United(the exact value starts with the prefix)country in [US, CA]andcountry contains C(a list value contains the substring)
The overlap detection uses heuristic analysis and may not catch all complex overlapping scenarios with deeply nested OR conditions. The validation provides best-effort protection while allowing legitimate non-overlapping rules to coexist.