# Nested

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.&#x20;

<table><thead><tr><th width="218">Key</th><th width="140">Type<select multiple><option value="E0Cs57JSKyBG" label="Integer" color="blue"></option><option value="ksO0FRw4oBgS" label="Boolean" color="blue"></option><option value="XJ81bAWrKRl1" label="String" color="blue"></option><option value="bMMJFACVlMos" label="Array" color="blue"></option><option value="bn7L3K4qyUDV" label="Object" color="blue"></option></select></th><th width="120" data-type="checkbox">Required</th><th width="277">Description</th><th>Example</th></tr></thead><tbody><tr><td><strong><code>conditions_logic</code></strong></td><td><span data-option="XJ81bAWrKRl1">String</span></td><td>false</td><td>The logic according to which the nested conditions are evaluated to determine the overall match. Can be one of <code>and</code> or <code>or</code>, default is <code>and</code>.</td><td><code>"any"</code></td></tr><tr><td><strong><code>conditions</code></strong></td><td><span data-option="XJ81bAWrKRl1">String</span></td><td>true</td><td>The nested <a href="/pages/Pm9784Fg2yQzMG9qkUCo">conditions</a> (checked on the parent condition's matches only).</td><td>Learn more <a href="/pages/Pm9784Fg2yQzMG9qkUCo">here</a>.</td></tr></tbody></table>

## 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.&#x20;

* 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:

<pre class="language-json"><code class="lang-json">"conditions": [
  {
    "field": "order.line_items.sku.code",
    "matcher": "start_with",
    "value": "PROMO",
    "group": "promo-products"
<strong>    "nested": {
</strong>      "conditions_logic": "or",
      "conditions": [
        {
          "field": "order.line_items.quantity",
          "matcher": "gteq",
          "value": 2
        },
        {
          "field": "order.line_items.unit_amount_cents",
          "matcher": "gt",
          "value": 15000
        }
      ]
    }
  }
]
</code></pre>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.commercelayer.io/rules-engine/conditions/nested.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
