Using Conditional Attributes

    Here is one example of how this feature might work on your web site. 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

    1. Create your custom products and add your attributes. Instructions to do so can be found here: Creating Custom Products
      • 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

    1. Choose the product class(es) the conditional attribute should be applied to - Example: ‘T-shirt’
    2. Select the parent attribute - this is the attribute that leads to possible child attributes -  Example: 'Is this a gift?’
    3. Select the parent attribute’s option - this is the option that triggers the child attributes to appear - Example: ‘Yes’
    4. Set the ‘Type of dependency’ to ‘Enable'
    5. 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
    6. Save Definitions
    7. 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.
    8. Check your custom products to make sure that the conditions work as expected.