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
Adding a rule
Section titled “Adding a rule”In the field form, scroll to Advanced — Validation & Conditional Logic and click Add Rule.
Show this field when [field_code] [operator] [value]| Operator | Matches |
|---|---|
equals | Exact value match |
not_equals | Anything except this value |
empty | Field has no value |
not_empty | Field has any value |
contains | Substring 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).
Worked examples
Section titled “Worked examples”Example 1: gift message conditional on gift wrap
Section titled “Example 1: gift message conditional on gift wrap”Two fields:
- Add Gift Wrapping (code:
gift_wrap, type:yesno, applies: cart page) - Gift Message (code:
gift_message, type:textarea, applies: cart page)- Conditional rule:
gift_wrapequals1
- Conditional rule:
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”- Dietary Restrictions (code:
dietary, type:multiselect, applies: profile, options: vegetarian, vegan, gluten-free, nut-allergy, halal, kosher) - Allergy Card Upload (code:
allergy_card, type:file, applies: profile)- Conditional rule:
dietarycontainsnut-allergy
- Conditional rule:
Allergy Card upload appears only if the multiselect includes “nut-allergy”.
Example 3: hide for empty parent
Section titled “Example 3: hide for empty parent”- Has Pet (code:
has_pet, type:yesno, applies: profile) - Pet Name (code:
pet_name, type:text, applies: profile)- Conditional rule:
has_petequals1
- Conditional rule:
- Pet Photo (code:
pet_photo, type:image, applies: profile)- Conditional rule:
has_petequals1
- Conditional rule:
Both child fields hide unless Has Pet = Yes.
Limitations
Section titled “Limitations”- Single parent reference per rule —
show this field when fieldA contains X AND fieldB contains Yworks.show this field when fieldA contains X OR fieldB contains Ydoesn’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.
JSON shape (advanced)
Section titled “JSON shape (advanced)”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.