How to create dependent custom options in Magento 2 |
Magento 2 Extensions |
Written by ITORIS Team, 2016-10-06 |
If you are the owner of a store, you might get into situation when you need to create dependent custom options, for instance, to apply custom design to products. By defaults Magento won't allow that. The ITORIS team developed an extension which allows to create complex option-based products. It's called the Dynamic Product Options extension for Magento 2. The extension includes dependent custom options, when one option or multiple options depend at the same time. Creating dependent custom options is not so challenging as it seems. Such options will help to make products visible or hidden if a specific choice is selected. Thus the options make the frontend's look more professional and easy to use. If you want to make one option invisible unless the previous one is not selected or vice versa – dependent custom options will do the work for you. In order to set these options, you have to enable the Dynamic Product Options extension. To find the detailed information you can refer to the User Guide. After the installation, please, go to: PRODUCTS -> Inventory -> Catalog. Click "Add Product" to add a new product or click the "Edit" link to edit an existing one. Let's imagine that you own a furniture store and want to vary a furniture design. Let's create a product with a conditional branching a furniture store might have. For example, you have the "Sofa" product and want to offer customers to select color or finish (leather or fabric).
The extension provides different field types: Input Box, Textarea, File, Dropdown, Radio Buttons, Check Boxes, Multiple Select, Date, Date & Time, Time. For instance, let's create the "Finish" dropdown which includes "Fabric", "Leather", and "Bonded Leather". Thus you offer your customers to choose the product's style. Then create radio buttons "Pattern" and "Color" to enlarge the choice. Now we need to make fields "Color" and "Pattern" dependent. To create the functionality first add field "Pattern". Click the "edit" icon next to the field and choose "Radio Buttons" in the field type.
Enter the title of the new field. If you want to make the field required, please select "Required" = Yes. Each option has the ability to make options dependent with "Visibility, Make it and If settings". Then set Visibility = hidden, make it = visible. If – press the "Edit" icon next to the field to create a condition. First choose the field to connect with "Pattern". If you want to connect "Fabric" with "Pattern" do the following. Click the "edit" icon to set a condition. Choose the field for the condition. In our case it's the "Finish" field or "F3". Click link "is" to select the option:
After you choose the option, enter "Fabric" to connect with "Pattern". Click the "Apply" button. Now you can see the rule in the "If" field. It will look like this: (F3 == 'Fabric'). The extension allows to enter the rule manually or use the "Edit" icon to simplify settings. Now let's make "Colors" dependent on a certain radio button in the "Pattern" field. If you want to make colors visible, when radio button "No Pattern" is selected, do the following. Add the field named "Color". Again you set the condition, when colors depend on the "No Pattern" radio button. It will look like this: (F5 == 'No Patern').
Save the changes. Let's move to the Frontend. For instance, when dropdown "Fabric" is selected, "Pattern" is visible.
Also if you select "No Pattern", an additional option such as "Color" will appear.
Using the extension you can hide the whole section with all fields in it and make a section dependent on another one. There are such settings as "Visibility, Make it, and If" at the section's top. Let's create a condition which allows to hide the "Features" section. Create other section named "More" with radio buttons "Price", "Features" and "Reviews" clicking "Add New Section". Now let's set the condition when the "Features" section depends on the "More" section. Click the "Edit" icon and choose the necessary section. The "Features" section will depend on radio button "Features". It will look like this: (F10 == 'Features'). On the frontend the whole section becomes visible, if you select the "Features" radio button.
The extension provides not only the ability to create dependent fields. In more complex cases a field can depend on several fields at the same time. You can also make the whole section with all fields in it visible based on the previous selection. The module also allows to edit custom options for different store views in Magento 2. Extend the functionality of your store with the Dynamic Product Options for Magento 2. Learn more about How to Create a Bundle Offer Based on Custom Options in Magento 2 Click here to know about How to Edit Custom Options for Different Store Views in Magento 2 Also check out the video tutorial about the whole functionality of the Dinamic Product Options extension
|