How to show or hide options with conditions
A condition makes an option appear or disappear depending on what the customer chooses, which variant is selected, or who the customer is. This article shows how to add a condition and what happens to hidden options.
Before you start
- The option you want to control and the option it depends on must be in the same option set.
- Options inside an Option group or Popup only show when their parent shows, and then only if their own condition is met.
Add a condition
- Open the option set and select the option you want to show or hide.
- At the top of the option panel, the line says Always shown. Click Add condition.
- Choose Show or Hide. The sentence reads "Show this option when...".
- Choose a source for the rule (see the table below), then the comparison and the value.
5. To add more rules, click Add rule. With two or more rules, choose whether to Match all or any of them.
6. Click Done, then Save.
Once saved, the condition is summarised in one line, such as "Shows when Add gift wrap is on and Wrapping paper is Gold". Click Edit to change it or Remove condition to delete it. An option can have up to 10 rules.
Rule sources
| Source | What it checks | Comparisons |
|---|---|---|
| An option (listed under Options) | What the customer chose in another option | is, is not, and for typed text also contains, doesn't contain |
| Variant (under Shopify variant) | The name of the selected variant, such as "Black / M" | is, is not, contains, doesn't contain |
| Customer tag | The tags of the logged-in customer | has tag, doesn't have tag |
A Switch is compared as On or Off. Choice options let you pick the value from a list. Number, Range slider, Date and Date range options are compared as a whole value, not with "contains".
File upload options and display-only options (headings, paragraphs and similar) cannot be used as a source.
What happens to a hidden option
- It is not shown on the page.
- It is not validated, so a required option that is hidden does not block Add to cart.
- Its value is dropped and not charged, and it is not written to the cart line.
- If the customer changes a choice or variant so that an option becomes hidden, the option's earlier value is cleared and the price updates.
Rules to know
- Variant rules compare names. If you rename a variant in Shopify, update the condition.
- Customer tag works only for logged-in customers. A guest has no tags. The editor tells you what a guest sees: with only tag rules, the option shows or stays hidden for guests depending on the rule. Tags are compared ignoring capital letters and spaces at the ends.
- No circular rules. An option that depends on the current option is not offered as a source, so two options cannot wait on each other.
- No contradictions. If a rule says an option is both "Gold" and "Silver" at once with all matching, the editor warns the option would never show or never hide, and offers Match any instead.
- Divider and Spacer options cannot have conditions. A condition on a Heading, Paragraph or other option works.
Worked example
You sell gift boxes. A Switch "Add gift wrap" ($3.00) and a Dropdown "Wrapping paper" (Gold $2.00, Silver $1.00).
- Select "Wrapping paper" and click Add condition.
- Leave Show, choose Add gift wrap as the source, and set it to On.
"Wrapping paper" now appears only when the switch is on. A customer who leaves the switch off pays nothing for paper, even if they picked one earlier and then switched back, because hidden values are not charged.