Here is one example of how this feature might work on your website. A customer buys a custom product and would like to give it as a gift and include a gift message. On the custom product page, the customer is asked: "Is this a gift". If they select "Yes", a message dialog box would open for the customer to enter their gift message. If they don't select "Yes", the message dialog box would remain closed.
The technical explanation is that this feature can be used to define dependency relationships between options and attributes for custom product classes. Dependent attributes will only be shown once the option on the parent attribute is selected.
PREPARE TO CONFIGURE CONDITIONAL ATTRIBUTES
-
Create your custom products and add your attributes. Instructions to do so can be found here: Creating Custom Products [1]
- The display type for the attribute that will be the ‘Parent’ has to be 'Select box' for it to show up as a parent conditional attribute. This corresponds to step 4 under ‘Add Attributes’ in the Creating Custom Products document.
For the example below, we’ve created a T-Shirt product with the following attributes:
- Size (display type: radio buttons’ options: small, medium, large)
- Is this a gift? (display type: select box; options: yes, no)
- Gift Wrap (display type:radio buttons; options: yes, no)
- Gift Message (display type:text field, no options)
- To (display type:text field, no options)
- From (display type:text field, no options)
ADD CONDITIONAL ATTRIBUTES
Navigate to: Store > Configuration > Conditional Attributes > Add Definitions
- Choose the product class(es) the conditional attribute should be applied to - Example: ‘T-shirt’
- Select the parent attribute - this is the attribute that leads to possible child attributes - Example: 'Is this a gift?’
- Select the parent attribute’s option - this is the option that triggers the child attributes to appear - Example: ‘Yes’
- Set the ‘Type of dependency’ to ‘Enable'
- Select dependent attributes’ - Select all the attributes that you want to appear when ‘Yes’ is the response to ‘Is this a gift?’ - Example: Gift Wrap, Gift Message, To and From
- Save Definitions
- Select the ‘Conditional Attribute Definitions’ tab and confirm all of the parent and dependent attributes you chose are listed under the products you assigned them to.
- Check your custom products to make sure that the conditions work as expected.