# Conditional Logic

{% hint style="warning" %}
**Before you start:** Both fields must be in the same Option Set. Conditional Logic cannot show or hide fields across separate Option Sets. If your fields are currently in different Option Sets, move them into one before continuing.
{% endhint %}

Conditional Logic makes your product page smarter. When a customer makes a selection, the right follow-up options appear automatically, and anything that doesn't apply stays out of the way.

**Example:** \
A shopper selects "Yes" to add a custom name\
A text field appears for them to add the customization\
If they select "No," the text field stays hidden.

<figure><img src="/files/U3FrW8NbkRvuE6GOLUlG" alt=""><figcaption></figcaption></figure>

***

### How It Works

One selection triggers the next. You decide which field appears when a customer picks a specific option and what should stay hidden.&#x20;

### Setting It Up

In this example, we'll show a text field for engraving only when a customer selects "Yes." If they select "No," the text field won't appear.

#### Step 1: Create both fields in the same Option Set

Open **Option Sets** in your Infinite Options dashboard and create or open an Option Set.

Add both fields inside it:

* **The trigger field** — the choice the customer makes first
* **The dependent field** — what appears based on that choice

{% hint style="info" %}
If your fields are already in separate Option Sets, move them into one before continuing. Conditional Logic will not work across separate sets.
{% endhint %}

***

#### Step 2: Set up the trigger field

On your first field, set the **Input Type** to Radio Buttons, Checkbox, or Dropdown.

Add the values **Yes** and **No**.

<figure><img src="/files/S6ZxxyQudX7D12tyX8aM" alt=""><figcaption></figcaption></figure>

#### Step 3: Set up the dependent field

On your second field, set the **Input Type** to **Text**.

<figure><img src="/files/gfSSB51tgU6YFPfs5WtF" alt=""><figcaption></figcaption></figure>

#### Step 4: Add the conditional rule

On the second field, click **Show Advanced Options**.

In the blue Conditional Logic area, click **Create a new conditional rule**.

<figure><img src="/files/ORW3NZoAZiXpiteXUlq6" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/DK23xy5J9BwMu69iCecp" alt=""><figcaption></figcaption></figure>

#### Step 5: Set the rule

Three things to fill in:

* **Field Name** — select your trigger field from the dropdown
* **Operator** — choose **Contains**
* **Value** — type **Yes**

<figure><img src="/files/RZvlPKTIIy6zckt0Njde" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/1rfoQCFnNG9GNLdAlVmg" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/bcWHa5nXjHi14SR8xc3z" alt=""><figcaption></figcaption></figure>

#### Step 6: Save

Click **Save Changes** at the top of the page.

Test it on your product page — select "Yes" and confirm the text field appears, then select "No" and confirm it disappears.

***

### Tips

* Both fields must be in the same Option Set. This is the most common reason Conditional Logic doesn't work.
* Use **Contains** as your operator. It's more flexible than an exact match and handles small differences like "Yes" vs "yes."
* Test on the live product page, not the Infinite Options preview. The preview doesn't always reflect conditional behavior accurately.
* Group related fields together in your Option Set — it keeps your setup organized and the customer experience logical.

If your logic is set up correctly but still isn't working, see the troubleshooting guide: [Conditional Logic isn't working](https://shoppad.gitbook.io/infinite-options/troubleshooting/conditional-logic-isnt-working)

***

### Something not working?

**The field isn't showing up when the condition is met.** The most common cause is that the conditional rule is attached to a variant field rather than another option field in the same Option Set. Check which field the rule is assigned to and make sure both fields are inside the same Option Set.

**The logic is set up but doesn't seem to be working correctly.** Review the rule carefully. Check that you selected the correct Field Name, that you're using Contains as the operator, and that the value you typed matches exactly what's in the trigger field. A small typo or the wrong field selected is usually the culprit.

**The condition seems to be triggering when it shouldn't.** If you used Is instead of Contains, any capitalization difference will cause unexpected behavior. Switch to Contains and re-test.

**Everything looks right in the app, but it's still not working on the product page.** Make sure the Option Set is assigned to the correct product and that you saved your changes. If it's still not working after that, reach out to support and we'll take a look.

***

<br>


---

# 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://shoppad.gitbook.io/infinite-options/conditional-logic/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.
