# How to set a conditional logic?

Conditional logic allows you to show or hide a field based on a customer’s selection.

#### **Example use case**

You want to ask customers whether their purchase is a gift. If the answer is **Yes**, you want to display an additional field for a gift note.

#### Step-by-step setup

1. First, create a **Checkbox** field with the label **“Is this a gift?”** and apply it to the relevant products.
2. Second, create another field (for example, a **Text Box**) for the gift note.
3. In the **Visibility** section of the second field, enable **Conditional Display**.
4. Set the condition:
   * **IF** the checkbox option equals **“Yes”**
   * **THEN** display this field.

{% hint style="warning" %}
Be sure to select the relevant product for the condition in the **Visibility** section to ensure the logic works correctly.
{% endhint %}

Once saved, the gift note field will only appear when the customer selects the **“Yes”** option for the **“Is this a gift?”** checkbox field.

{% hint style="info" %}
Conditional display is only available for dropdown, checkbox, radio button and image swatch fields.
{% endhint %}

<figure><img src="/files/vyBmeV46O2sic5fSm3jV" alt=""><figcaption><p>Please click "Create this condition" button</p></figcaption></figure>

<figure><img src="/files/NotxzvLCuz0g4hL9qRtb" alt="Condition Added "><figcaption></figcaption></figure>

{% hint style="warning" %}
If you do not click "Create this condition" button, the selected criteria is not saved.
{% endhint %}

Once everything is set, this is how it will appear on your product page. When “Yes” is selected, the text box is displayed. If “No” is selected, the text box remains hidden.

<div><figure><img src="/files/4APyCryhtGqYe6UdsSi4" alt="Is this is a gift? -Yes "><figcaption></figcaption></figure> <figure><img src="/files/IzTGa5QXltdTvRkX3BRc" alt="Is this is a gift? -No "><figcaption></figcaption></figure></div>

Watch the detailed video to learn how to apply conditional logic.

{% embed url="<https://youtu.be/FMuMv7BpwNc>" %}


---

# 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://minimateapps.gitbook.io/customfield/how-to.../how-to-set-a-conditional-logic.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.
