Need to create rules based on bundles?
Learn more
LogoLogo
APIsChangelog
  • Getting started
  • Rules
  • Conditions
    • Scope
    • Aggregations
    • Nested
    • Dynamic values
  • Actions
    • Types
      • Percentage
      • Fixed amount
      • Fixed price
      • Buy X pay Y
      • Every X discount Y
    • Bundle
      • Balanced
      • Every
    • Aggregation
    • Limit
  • Matchers
  • Operators
  • Check and validation
  • Core API integration
    • Order rules
    • Price rules
    • Virtual relationships
  • Resources
    • Promotions
    • Price lists
  • Use cases
    • Promotions
      • Discount line items based on item's price
      • Get a discount when paying by credit card
      • Discount an order based on promo item and total number of items
      • Offer a specific shipping method for free in a specific country
      • Discount items with large stock availability
      • Discount all the SKU in an order based on the shipping country
      • Discount all the SKU in an order based on the customer email domain
    • Price lists
      • Discount all prices greater than or equal to a specific value
      • Discount specific SKUs for new clients
      • Change strike-through price based on customer email domain
On this page
  1. Conditions

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

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
        }
      ]
    }
  }
]
PreviousAggregationsNextDynamic values

Last updated 2 months ago

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

Learn more .

conditions
here