How to add conditional logic to your product add-ons
When you use the WooCommerce Product Options plugin to create your product add-ons, it's easy to add conditional logic. Each product add-on comes with an option to show or hide it based on the user's other selections. That way, you can create dependencies between your options or add-ons.
An example of conditional logic
For example, in the below screenshot, clicking 'Use pre-built template' conditionally displays the 'Your name' and 'Job title' product options, which are not required when 'Upload my own design' is selected:
How to add conditional logic to product add-ons
- Edit the option group that contains the options that you want to add conditional logic to.
- Click to add or edit an option, and add each add-on as a separate 'Choice'.
- Click on the 'Advanced' toggle to display the conditional logic section.
- Select the logic that you require.
For example, the following screenshots show how we added a gift wrap option to a product. The product page loads with only one add-on visible: "Gift Wrapping." When the customer clicks the "Yes please" checkbox, the other gift wrap product add-ons appear underneath using conditional logic.
Further reading: The complete guide to creating WooCommerce conditional variations.