Skip to content

Conditional logic

Conditional logic lets you hide a field unless another field has a matching value. Useful for:

  • Show Gift Message only if Add Gift Wrap = Yes
  • Show Tax Exempt Certificate only if Customer Type = Tax Exempt Buyer
  • Show Allergy Details only if Dietary Restrictions is not empty

In the field form, scroll to Advanced — Validation & Conditional Logic and click Add Rule.

Show this field when [field_code] [operator] [value]
OperatorMatches
equalsExact value match
not_equalsAnything except this value
emptyField has no value
not_emptyField has any value
containsSubstring match. For multiselect arrays, this checks array membership.

Click Add Rule again to add another. Multiple rules are ANDed (all must match for the field to show).

Example 1: gift message conditional on gift wrap

Section titled “Example 1: gift message conditional on gift wrap”

Two fields:

  1. Add Gift Wrapping (code: gift_wrap, type: yesno, applies: cart page)
  2. Gift Message (code: gift_message, type: textarea, applies: cart page)
    • Conditional rule: gift_wrap equals 1

The Gift Message textarea only appears after the customer toggles Gift Wrap on.

Example 2: file upload conditional on dietary needs

Section titled “Example 2: file upload conditional on dietary needs”
  1. Dietary Restrictions (code: dietary, type: multiselect, applies: profile, options: vegetarian, vegan, gluten-free, nut-allergy, halal, kosher)
  2. Allergy Card Upload (code: allergy_card, type: file, applies: profile)
    • Conditional rule: dietary contains nut-allergy

Allergy Card upload appears only if the multiselect includes “nut-allergy”.

  1. Has Pet (code: has_pet, type: yesno, applies: profile)
  2. Pet Name (code: pet_name, type: text, applies: profile)
    • Conditional rule: has_pet equals 1
  3. Pet Photo (code: pet_photo, type: image, applies: profile)
    • Conditional rule: has_pet equals 1

Both child fields hide unless Has Pet = Yes.

  • Single parent reference per ruleshow this field when fieldA contains X AND fieldB contains Y works. show this field when fieldA contains X OR fieldB contains Y doesn’t, because rules are AND-only. Workaround: create two separate fields with different rule sets, mark one inactive when the other should show.
  • Same-surface dependencies — the parent field must be on the same surface as the conditional child. Cross-surface rules (hide a profile field based on a cart page value) don’t work because the values aren’t loaded together.
  • Storefront-side only — admin order view, transactional emails, and PDFs show all values regardless of conditional rules. Hiding is a render-time UX decision, not a data-storage rule.

The conditional logic JSON stored on each field looks like:

{
"show_when": [
{ "field": "gift_wrap", "operator": "equals", "value": "1" },
{ "field": "card_type", "operator": "not_equals", "value": "amex" }
]
}

You can edit this directly in the field form’s Conditional Logic (JSON) textarea if you prefer raw JSON over the rule builder.