A customer who hasn't asked for engraving shouldn't see an engraving text box, a font picker and a position menu. A long form is more to read and more to get wrong, and every extra field is one more thing a customer can leave blank or fill in badly.
Shopify conditional product options solve this by showing a field only when an earlier choice makes it relevant. This guide covers what you can base a condition on, how to set one up, and the patterns that work for engraving, apparel and phone cases, using Live Product Options (LPO).
Why Shopify doesn't do this on its own
A theme's variant picker shows every value, and a plain text field is just an input. To show or hide one based on another choice, answers on the Shopify community say you need JavaScript in your theme, because Liquid and HTML alone can't react to a selection (example thread). That code has to be written, tested on mobile and kept working after theme updates. Our build or buy guide covers when that is worth doing.
What a condition can look at
In LPO, every option and every preview layer can carry conditions. They are checked each time the customer changes an option (LPO docs). A condition can read three things:
- Another option. Whether it equals a value, doesn't equal it, contains text, or is empty or filled. Numeric options also compare with greater than, less than and equal.
- The product. Its handle, title, type, vendor or tags. This lets one set of options behave differently across a collection.
- The selected variant. Specific variants, or the variant title.
Several conditions combine with AND by default, so all must be true. Choose "any" to switch to OR. To match one of several values, list them with commas, such as large,xlarge. String comparisons ignore case.
Set one up: engraving only when asked for
- Add a checkbox option named
add_engravingwith the label "Add custom engraving". Give it a price if you charge for it. - Add a text option named
engraving_textand mark it required. - On the text option, click Add condition, choose the option condition, pick
add_engravingand set it to equalsyes. - Repeat for a font picker or any other engraving field.
Conditions refer to options by name, so keep names short, lowercase and unique. In the editor, an eye icon shows whether an option is currently visible. It is a testing aid only and doesn't change what customers see (LPO docs).
Patterns worth copying
These come from LPO's own reference examples. Adapt the names and values to your product.
-
A chain. An option "Personalization type" with None, Text, Image and Text and Image. The text field shows when the type equals
text,both. The upload shows forimage,both. A "Text position" menu shows only when the text field is not empty. Typical for: custom apparel, gifts. - Variant-specific fields. A color picker that appears only on the "Custom Color" variant, using a variant title condition. Or an engraving field only on the gold variant. Typical for: jewelry, watches.
- Size-dependent extras. A "Reinforced stitching" add-on that shows only for XL, XXL and XXXL. Typical for: apparel, bags.
- Quantity notices. A note about bulk pricing that appears once the quantity option reaches 50.
- Conditions on the preview. Layers carry conditions too, so the preview can change with the choice. With design areas that share an area key, a text layer repositions itself when the customer switches phone model (LPO docs). Typical for: phone cases, multi-view products.
Things that trip people up
-
Size rules need a helper. A condition on a dimension option compares its formatted text, not the numbers. For a rule like "width over 100", create a value formula that reads
options.controller('dimension').x. Value formulas need the Formula extension. - Negative conditions on multi-select. With a multi-select option, "does not equal" and "does not contain" can return true more often than you expect. Test them.
- Translated values. If you put a translation key in an option's Value field, update the conditions that match that value (LPO docs).
- Prefer "is not empty" to a specific value when the rule is "show if filled in". It keeps working if you reword the choices.
- Hidden required fields. The docs don't say whether a hidden option is validated or saved to the cart and order. Place a test order that skips the condition, and open the order to see what arrived.
Where to start
Pick the product with the longest option form. List each field and write down the choice that makes it relevant. Add conditions to one chain first, for example engraving, then test it on mobile and in a test order before you copy the pattern to other products.
