> For the complete documentation index, see [llms.txt](https://docs.optis.me/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.optis.me/product-options/advanced-setup/advanced-conditional-logic-shopify-variant.md).

# Advanced conditional logic (Shopify variant)

## 🎯 Objective

Show or hide an option (or group) based on the **Shopify variant** your customer has selected on the product page. For example, show an "Engraving" text box only when the customer picks the variant **White / Large**.

New to conditional logic? Start with [Basic conditional logic](https://docs.optis.me/product-options/advanced-setup/how-to-set-up-conditional-logics.md), which shows or hides options based on other options in the option set.

{% hint style="info" %}
Shopify variant conditions work on [**Storefront V2**](https://docs.optis.me/product-options/optis-storefront-v2/how-to-upgrade-to-storefront-v2.md) only. If your store still uses the Legacy storefront, you will not see **Shopify variant** in the **Source** list.
{% endhint %}

## How to set it up

1. Open the option (or group) and go to the **Display** tab.

2. Under **Visibility**, click **Add condition**. New conditions start with **Shopify variant** as the source.<br>

   <figure><img src="https://1821185975-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRFiuDpHWm2HwzxPH4lfM%2Fuploads%2FJLvdzNhnqC6ncrB6qZtm%2Fimage.png?alt=media&amp;token=5bb3973d-9eec-451a-8f50-eff858319a82" alt=""><figcaption></figcaption></figure>

3. Choose **Show** or **Hide**, and whether **all** or **any** of the conditions must match.<br>

   <figure><img src="https://1821185975-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRFiuDpHWm2HwzxPH4lfM%2Fuploads%2F2xUAN2dKZDe82dyPkXnu%2Fimage.png?alt=media&amp;token=15ef0dfe-893e-46dc-b7d6-ea58565f51f8" alt=""><figcaption></figcaption></figure>

4. Choose a **Condition** and a **Value** (see the table below).

5. Click **Save**.

Unlike basic conditional logic, an option set with only one option can already use Shopify variant conditions.

You can mix sources in the same block. For example, one condition can use **Shopify variant** and another can use an **Option**, combined with **all** or **any**.

## Conditions and values

| Condition                           | Value                                                                                                     |
| ----------------------------------- | --------------------------------------------------------------------------------------------------------- |
| **is** / **is not**                 | Click **Select product variant**, then pick the variant in the popup.                                     |
| **contains** / **does not contain** | Type text. OPTIS looks for it inside the variant name. Spaces and uppercase/lowercase must match exactly. |

<figure><img src="https://1821185975-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRFiuDpHWm2HwzxPH4lfM%2Fuploads%2FLrNZxJ5vg4l5qfNHCLp5%2Fimage.png?alt=media&amp;token=c946f326-00ea-4d50-960b-c6b9f0f94484" alt=""><figcaption></figcaption></figure>

### Pick a variant (is / is not)

1. Click **Select product variant**.
2. Search by product name or variant name, then select one variant.
3. Confirm. The condition now shows `Product name / Variant name`.

* You can pick a variant of **any product in your store**, not only the product this option set applies to.
* Products with only the **Default Title** variant are not listed, because they have no real variants to choose from.
* The condition is saved by variant, not by name. If you rename the product, option or value in Shopify, **is** / **is not** conditions keep working.

<figure><img src="https://1821185975-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRFiuDpHWm2HwzxPH4lfM%2Fuploads%2FxtwV72f7hXIKV4Keco6v%2Fimage.png?alt=media&amp;token=4c788fdd-d6e8-4275-96f8-54405b966bc0" alt=""><figcaption></figcaption></figure>

### Contains / does not contain

Shopify joins the values of a multi-option variant with " / ", for example **White / Large**. Type the text the same way, for example `White / Large`, or just `Large` to match every Large variant. Because the match is exact, use **is** / **is not** when you need to target one specific variant.

<figure><img src="https://1821185975-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRFiuDpHWm2HwzxPH4lfM%2Fuploads%2FcKTX5TDzUb7GRuXWsdGs%2Fimage.png?alt=media&amp;token=2685f821-a6e9-431a-a95d-bd36568f2acf" alt=""><figcaption></figcaption></figure>

## Good to know

* **Deleted variant or product:** if the variant you selected is deleted in Shopify, the condition shows **Variant not found** in red. Pick another variant or remove the condition.
* **Preview in the editor:** the preview has no customer-selected variant, so Shopify variant conditions are ignored there and the option stays visible. Check them on your storefront. Conditions based on other options still show or hide the option in the preview.
* **Duplicate a condition:** the copy keeps the same product and variant.
* **Rolling back to the Legacy storefront:** Legacy does not support Shopify variant conditions. The rollback popup shows how many option sets use them, and those conditions are ignored on your storefront until you upgrade to Storefront V2 again.
* **Import / Export:** Shopify variant conditions are included in the CSV file. See [Export and Import Option Sets](https://docs.optis.me/pages/WnDdmTGHHjchuBgpVwvU#id-7.2-visibility-conditional_logic).
