Skip to content

Conditional form fields

What you’ll build: a question that reveals a follow-up field depending on the answer. For example, “Is this a gift?” → Yes shows a “Gift message” field.

Requirements: Shopify Plus and the Buddy plan, because the form has more than one field.

With Custom fields, both fields go in one form, and the follow-up has its own rule.

  1. Create the form. On the Fields tab, click Create customization, choose Custom fields, then Start blank.

  2. Add the question. Choose Single choice from the field types.

    • Question: Is this a gift?
    • Choices: Yes and No.
  3. Add the follow-up. Click Add field and choose Paragraph.

    • Question: Gift message
    • Set Show this field to Only when…, then choose Is this a gift?, is, Yes.

    The Preview shows the rule working: pick Yes and the gift message appears.

  4. Publish and place it. Under Status, turn on the switch so it reads Published, and save. In the Checkout Editor, add the Custom fields app block where the form should show. See add a form.

  5. Test it in a real checkout: pick Yes and the gift message appears; pick No and it disappears.

Both answers are saved on the order under Additional details, as Is this a gift? and Gift message. If the customer picks No after writing a message, the message is removed from the order.

The Gift message template is a ready-made version: a This is a gift checkbox that shows a message and who it’s from.

Example: show a checkbox after a date is picked

Section titled “Example: show a checkbox after a date is picked”
  1. Add a Date field, Delivery date.
  2. Add a Checkbox field, for example “Leave at the door if nobody’s home”, and set Show this field to Only when… Delivery date has an answer.
The other field is a… You can check that it…
Checkbox is checked, isn’t checked
Dropdown, Single choice is, isn’t a choice, has an answer, has no answer
Multiple choice includes, doesn’t include a choice, has any checked, has none checked
Number is, is more than, is less than, has an answer, has no answer
Date, Date of birth is after, is before a date, has an answer, has no answer
Text fields is, isn’t, contains, doesn’t contain, has an answer, has no answer
  • Several rules: add more conditions and choose All of these are true or Any of these is true.
  • Three or more levels work: a field can depend on one that depends on another.
  • Hidden fields don’t need an answer, even when required, and any answer they saved is removed.
  • Rules use the field, not its key, so renaming the question or changing its key doesn’t break them.
  • Choices are matched in your default language, so rules work for customers checking out in any language.

Older form blocks can’t hold rules between fields. Instead, each field is its own block. Every form field saves the customer’s answer as a checkout attribute, whose key is the block’s Name (its first 28 characters) and whose value is the answer. A second block then uses the Cart attribute key, value condition to appear only when that attribute has a certain value.

Older form blocks aren’t offered for new forms, so use these steps to check or fix a setup you already have. For a new one, use the Custom fields steps above.

  1. Create the question. Click Create customization and choose Radio.

    • Name: Is this a gift. This becomes the attribute key, so keep it short and don’t rename it later.
    • Add two options with Label Yes / No. Also fill in Value (optional) with yes and no: the value then stays the same if you translate the labels.
    • Save, and note the block’s ID.
  2. Create the follow-up. Choose Text field.

    • Name: Gift message. Label: Gift message.
    • In Conditions, choose Show only when conditions pass and add Cart attribute key, value:
      • Key: Is this a gift
      • is equal to
      • Value: yes
    • Save, and note its ID.
  3. Place both. In the Checkout Editor, add one Checkout Buddy (v1) app block where you want the fields and enter both IDs in Multiple block IDs, for example 41, 42. They’re shown in that order, and the follow-up only appears once its condition passes. See the Checkout Editor.

  4. Test it in a real checkout: pick Yes and the gift message appears; pick No and it disappears.

Both answers are saved on the order as additional details, under the keys Is this a gift and Gift message.

Example: show a checkbox after a date is picked

Section titled “Example: show a checkbox after a date is picked”
  1. Create a Date field block named Delivery date.
  2. Create a Checkbox block (for example “Leave at the door if nobody’s home”) with the condition Cart attribute key, value, Key Delivery date, is not equal to, Value left blank. A blank value with is not equal to means “has any value”.
  3. Place both, as in step 3 above.
Field A is a… Its saved value Condition for field B
Checkbox true or false is equal to true
Radio, Select The option’s value, or its label if no value is set is equal to the value
Multiple checkboxes Every ticked value, joined with commas is equal to only works for an exact combination; prefer Radio
Text field, Date field What the customer entered (dates as YYYY-MM-DD) is not equal to with a blank value, for “anything entered”
  • Keys and values must match exactly, including capitals and spaces.
  • Renaming field A changes its key. Update field B’s condition if you rename it.
  • Using your own key. Instead of the Name, you can set a key with Apply effect when value changes → Apply value as checkout attribute → Attribute key. Use that key in the condition.
  • Three or more levels work the same way: each field’s condition checks the previous field’s key.
  • Hidden fields keep their value. If a customer fills in field B and then changes field A, B disappears but its earlier answer stays saved on the order.
  • More on the fields themselves: older form fields and choice fields.