For the complete documentation index, see llms.txt. This page is also available as Markdown.

Turn on conditional logic

Where the conditional logic switch lives, and what the Show, Hide, All, and Any choices actually do.

Before you start

  • An option set is open in the builder with at least two options: one that reacts, and one that triggers the rule.

  • The option you want to use as a condition must appear above the option you are configuring. If it does not, move it up first. See Build your options.

  • Conditional logic may not be available on all plans. If the switch is grayed out, see Compare plans.

Steps

1

Select the option that should appear or disappear

Apply the rule to the option whose visibility you want to control, not to the option that triggers it.

For example, to display a gift message field when gift wrapping is selected, apply the rule to the gift message option.

2

Turn on Conditional logic

On Basic, find the Conditional logic switch and turn it on.

A rule builder appears directly underneath.

3

Choose the action

The first dropdown is Show or Hide.

4

Choose the matching mode

The second dropdown is All or Any. It applies only when a rule has more than one condition.

5

Build the condition

One row: a source, an operator, and a value. See Build a condition.

6

Test it in the preview

The builder's live preview applies your rules. Change the trigger option and check that the dependent option is displayed and hidden as expected.

The preview cannot test variant-based conditions, because no variant is selected there. See Live preview and inspector.

7

Save

Then test on your storefront with View in Store, checking both branches.

The conditional logic switch turned on with the rule builder revealed underneath
The rule goes on the option being shown or hidden, not on the trigger.

Show or Hide

Both produce the same result from opposite directions. The rule is evaluated, and then:

Action
Conditions met
Conditions not met

Show

The option is visible

The option is hidden

Hide

The option is hidden

The option is visible

Which to choose

The two actions are logically interchangeable, but one is usually easier to read later.

What you want
Use

An option that is normally irrelevant and becomes relevant

Show — the default state is hidden, which is what you want

An option that is normally relevant, with one exception

Hide — the default state is visible

An option revealed by a single yes-or-no choice

Show when the switch is enabled

An option that must disappear for one specific variant

Hide when the variant matches

Use Show by default. An option that starts hidden and appears when needed keeps the initial form short, which is the main purpose of conditional logic.

All or Any

Mode
Fires when
Effect

All

Every condition is true

Narrows. Each condition you add makes the rule fire less often.

Any

At least one condition is true

Widens. Each condition you add makes the rule fire more often.

With a single condition, this setting has no effect.

Worked comparison

Two conditions: Gift wrap contains Yes and Delivery is equal to Express.

Mode and action
The option appears when

Show + All

Gift wrap is ticked and delivery is Express

Show + Any

Gift wrap is ticked or delivery is Express

Hide + All

Everything except when both are true

Hide + Any

Only when neither is true

The last two combinations are the ones most often misread. Hide with Any hides the option when any one condition is true, so the option is displayed only when none of them are true.

Adding and removing conditions

  • Add another condition appends a row.

  • Each row has a delete action.

  • All rows in a rule share the same All or Any mode. You cannot combine A and (B or C) in a single rule.

When you need mixed logic

To build logic such as A and (B or C), split it across two rules:

  • Apply part of the logic to a Section and the rest to the option inside it. Both rules must match for the option to be displayed, which creates an AND between them.

  • Or add two copies of the option, each with its own rule, and make sure their conditions cannot both be true at the same time.

Rules on a Section

Section supports conditional logic in the same way as other option types. A rule on a section controls every option inside it.

Use a section rule when more than two options share the same condition. One rule replaces several identical rules, and you only need to edit it in one place when the condition changes.

See Section.

Notes

  • A hidden option is not validated, so a required option that is currently hidden does not block Add to cart.

  • A hidden option with an add-on price is not charged. Hiding removes the charge.

  • Rules are evaluated in the customer's browser as they make selections. No page reload is required.

  • Rules are evaluated on the storefront and in the builder preview. Customer and country rules are not, because they control whether the whole option set is displayed.

Last updated

Was this helpful?