Conditional Logic for Woo Product Add-ons

Beskrivelse

Conditional Logic for WooCommerce Product Add-Ons is an extension to the official WooCommerce Product Add-Ons plugin. With the help of this extension, you can set up conditional logic for Add-ons fields to either show or hide them based on what the user chooses, write or upload in other fields. Also you can determine to display add-ons fields only for specific product variations.

Important links:
Premium Version Page | Demo for Plugin Testing | Plugin Documentation

Conditional Logic is designed to work with any field of Product Add-ons, and each field can have its own rules. Fields for which you set conditions can be shown or hidden if Any or All requirements are met. Conditions – set of rules of what the user (your customer) should choose, write or define in other fields. Let’s say you offer two types of Gift Wrap options (Free and paid), and you’d like to offer an ‘Add a message’ service to the Paid option only – then you set the ‘Short text’ field to be visible only when the customer chose the Paid option.
In the Premium version of the plugin you can also add conditions to show Product Add-ons field only when user select specific Product Variation. This feature can work alone or you can combine it with another conditions based on other add-ons fields output.

Types of conditions depend on the kind of field you use as the condition.

Multiple choice and Checkboxes types can be conditioned as:
Is checked – when the customer selects the needed option
Is not checked – when the customer selects or checks anything besides the specified option

Short Text and Long Text have the following condition types:
Is – text entered by a customer fully complies with your value
Is not – text entered by a customer is not the same as your value
Is empty – the customer does not enter any text
Is not empty – the customer enters any text
Text contains – text entered by the customer contains something specific anywhere in the text
Text does not contain – text entered by the customer does not contain what you specified anywhere in the text
Text starts with – text entered by the customer starts with anything specific
Text ends with – text entered by the customer ends with anything specific

File upload field type may have the following logic:
Is selected – if the customer has chosen a file to upload
Is not selected – if the customer has not chosen a file to upload yet

Customer Defined Price and Quantity are numeric types of fields, and their conditions may be:
Is – price entered by customer or selected quantity is equal to your value
Is not – price entered by customer or quantity is anything besides the value you set
Is greater than – price entered by customer or quantity is greater than the value
Is less than – price entered by customer or quantity is less than the value
Is greater than or equal – price entered by customer or quantity is greater than or equal to the value
Is less than or equal – price entered by customer or quantity is less than or equal to the value

Those conditions are available to you in the general add-ons section as well as on the product level.

Note: you should have WooCommerce Product Add-Ons plugin installed and configured.
You can find detailed instructions on how to hide and show WooCommerce Product Add-On options here in plugin’s documentation

Skjermskudd

  • How conditional fields work on product page
  • Premium feature: display field based on selected variant
  • How to add Conditional logic to add-ons field
  • Premium feature: show Product Add-ons fields only when specific variation selected
  • Dependencies for fields used as conditions
  • Two types - if all rules match or any (when condition works)
  • Condition types for Multiple choice and Checkboxes types of field
  • Condition types (relations) for text fields
  • Condition types for File upload type of field
  • Condition types for numeric types of fields

Installasjon

  1. Upload the plugin files to the \’/wp-content/plugins/conditional-logic-for-woo-product-add-ons\’ directory, or install the plugin through the WordPress plugins screen directly.
  2. Activate the plugin through the \’Plugins\’ screen in WordPress
  3. To design conditionals to your Add-ons’ fields, go to products with addons (if you have them separately for each product) or to Products > Add-ons > choose Add-ons Group
  4. Click on the ‘Conditional logic’ checkbox in the field for each you want to add conditions

FAQ

What addons plugins can be used along with this conditional logic?

The Conditional Logic for WooCommerce Product Add-ons is designed to work only with official Product Add-ons. You won’t be able to set up conditional logic without that plugin and with any other plugin of that type.

How to show product add-ons field only when specific variant (e.g. red cap for red hoodie) is selected?

When you enable Conditional Logic for field, you will find Variations section. If you leave it empty – this field will be shown for every product variation. If you need to show the field only for specific variations – click on the field and select variations of the product, for which it will be displayed.

Is there any type of field conditional logic cannot be applied to?

Conditional logic can be applied to any default Product Add-ons field. As well as, all of the fields and their options can be used as conditionals.

Are there any limits to the number of conditions set to one field?

Yep, in community version it’s limited to one condition. In premium version you can add as many conditions as you need.

When trying to add the conditional logic, I see an error saying Please update (re-save) the post to set up conditional logic

That means you have not yet updated the add-on or product. Conditions need to assign a special slug to each field and its options, and that happens only when you update the add-on or product after installing the plugin.

Vurderinger

29. oktober, 2023
Have set up many products when realized the woocommerce addons plugin does not allow me to hide/show them conditionally. This addon solves the issue perfectly! It'd have took a lot of time to switch to another addon plugin. Thanks!
11. juli, 2023 1 svar
It would be perfect, but it didnt work on my website. The product pages didnt update with the fields hidden.
Les alle 4 vurderinger

Bidragsytere og utviklere

“Conditional Logic for Woo Product Add-ons” er programvare med åpen kildekode. Følgende personer har bidratt til denne utvidelsen.

Bidragsytere

Endringslogg

2024-02-01 – version 2.1.2
* Fix: Add to cart button action, when required field is hidden under conditions
* Updated: Woo Product Add-ons 6.6 version compatibility

2023-12-12 – version 2.1.1
* Fix: Required field (radio buttons) optional when hidden
* Fix: Not displaying conditional logic fields to global add-ons after adding and re-saving

2023-11-16 – version 2.1.0
* Fix: Make required field (checkbox) optional when hidden
* Fix: Product name for variations with 3 or more attributes
* Updated: Woo Product Add-ons 6.5 version compatibility
* Updated: Woo 8.2.2 version compatibility
* Updated: Woo Cart and Checkout blocks compatibility
* Updated: WordPress 6.4.1 version compatibility

2023-07-26 – version 2.0.0
* New feature: Conditions based on selected product variation
* Updated: WooCommerce Product Add-ons version compatibility

2023-07-05 – version 1.2.1
* Updated Freemius SDK to the latest version

2023-06-17 – version 1.2.0
* New feature: All required fields will stay optional if those fields are hidden
* HPOS compatibility

2023-04-20 – version 1.1.0
* WooCommerce Product Add-ons 6x version compatibility
* Minor UI improvements

2023-01-10 – version 1.0.0
* Initial release