Nested

How to nest conditions into one another

Conditions can be nested one into the other to add additional conditions on the matches of a condition's main matcher, according to the specified nested conditions logic.

Key
Type
Required
Description
Example

conditions_logic

String

The logic according to which the nested conditions are evaluated to determine the overall match. Can be one of and or or, default is and.

"any"

conditions

String

The nested conditions (checked on the parent condition's matches only).

Learn more here.

Example

The following condition uses a nested.conditions array to check if an order contains at least two units of a promotional product or a promotional product that cost more than a specified price.

  • The parent condition checks which line items of the order are associated with an SKU code that starts with a substring used to identify all the promotional products.

  • The nested conditions check (according to an OR logic) if any of those line items has a quantity greater than or equal to 2 or a unit amount greater than 15000 cents:

"conditions": [
  {
    "field": "order.line_items.sku.code",
    "matcher": "start_with",
    "value": "PROMO",
    "group": "promo-products"
    "nested": {
      "conditions_logic": "or",
      "conditions": [
        {
          "field": "order.line_items.quantity",
          "matcher": "gteq",
          "value": 2
        },
        {
          "field": "order.line_items.unit_amount_cents",
          "matcher": "gt",
          "value": 15000
        }
      ]
    }
  }
]

Last updated