Articles on: Conditional logic

Conditional logic: Show/hide options based on customer selection with rules



You can add rules to option sets to show/hide options and/or specific values of an option based on what the customer selected. For example if you sell T-shirts and create a check box option to "Add custom text" on T-shirts, with conditional logic you can make the text input field only visible if the customer checked in the "Add custom text" option.

Create rules



1. Open the option set where you want to set rules between the options



2. Create your first rule





On the option set page in the "Rules" section click the "Create rule" button it will open a modal to create a rule.

Each rule has 3 parts:
Rule name: This is only visible for you to easily recognize the rule later on
Rule condition: In the condition you can specify the customer selection when the rule should be applied. You can have multiple conditions in the same rule.
Rule action: In the action you can choose to show or hide specific values of an option if the condition is true. To hide the whole option select all the values. You can add multiple actions to the same rule.



Create condition


The condition specifies the customer selection when the rule should be applied.

First you need to select the option which you want as the basis of the condition.



Then you need to set when the condition should be true:
For customer selection option types (eg.: dropdown, button, checkbox etc.) you can set the condition to be true if the customer selection "is one of" or "is not one of" the option's values



For customer input option types (eg.: text box, number field, date picker etc.) you can set the condition to be true if the input "is not empty" or "is empty"



You can create multiple conditions in a rule, in that case you can choose if "Any" or "All" of the conditions needs to be true to apply the action(s).



Create action


In the action you can choose to show or hide specific values of an option if the condition is true.

First you need to choose whether the action should show or hide an option/values of an option in the option set.



Then you need to choose the option that should be shown/hidden:
For customer selection option types (eg.: dropdown, button, checkbox etc.) you can choose specific values of the option that should be shown/hidden. If you select all the values, the whole option will be shown/hidden (including the option name and description)


For customer input option types (eg.: text box, number field, date picker etc.) the whole option will be shown/hidden



You can add multiple actions in a rule, in that case if the condition is true, all of the actions will happen.

The "Show" action hides the selected values when the condition is NOT true
Do not create multiple rules that show the same values because that can cause a conflict resulting in some of the show rules not working. Always structure your rules in a way that you don't have multiple rules showing the same values.

3. Save changes



Duplicate rules



You can easily duplicate rules in an option set by clicking the duplicate icon next to the rules.



If you duplicate a whole option set the rules in it will be duplicated as well along the options

Updated on: 07/03/2024

Was this article helpful?

Share your feedback

Cancel

Thank you!