Written by the Divi Engine Documentation Team
Watch This Video
Follow these steps to set up conditional filters. Please know that there are two types of conditional filters.
Standard Conditional Filter
Step 1: Add A Master Filter
Standard Conditional filter is based on the option selected in a master filter. The master filter is the first filter that the user will see. For example, if I would like to display different filters based on the colour selected. In this case, the colour filter is the master filter. Add this filter with a Condition Filter Title and ID. The ID can only be lowercase with no spaces.
Step 2: Add Other Filter Items & Define The logic
The next step is to add the other filters that contain the logic in the Conditional Logic section. In this example, the filter shows when the colour Gray is selected from the master filter.
- Enable the conditional logic.
- Select whether any or all of the rules should apply.
- Choose the master filter that you want to control.
- Choose the condition. As you can see below it is equals, does not equal, is greater than, is less than, contains, does not contain, is empty, is not empty.
- Define the value if needed. For example, we wanted to only show if the colour equals grey. Here you would need to make sure your value is correct.
- Add another condition.
Conditional Categories Filters
If you want to have two filters and one be updated based on the selection of the parent categories follow these steps.
Step 1: Add Parent Category Filter
Add the Parent Category Filter defining it to show ONLY parent categories. After doing this you will need to set the Conditional ID and Name.
Step 2: Add Subcategory Filter
Add a second Filter Item defining it to be the Subcategory Filter. To do this you will need to edit the Main Options, Category Filter Options and Logic. Make sure that it shows all for the category display mode. When defining the logic, enable the logic and make sure these conditions are met.
- Relation = ALL
- Parent Category (defined above) does not equal
- Parent Category (defined above) is not empty
Now, this filter will be updated based on the parent category selection.
Please email us at [email protected] if you are unable to get Divi Ajax Filter working.