Category Filter Options
Divi Ajax Filter (and BodyCommerce/Machine) offer some clever ways to help you display the categories the way you want.
Once you have chosen "Category" as the thing you want to filter, head over to the Category Filter Options tab
- Choose what Categories you want to display
- Only Parent Categories
- Only Sub Categories of Selected Category (you then define the slug of the parent category below)
- Sub Categories of the current category (this is when you are on the category page itself)
- All (default)
- Parent slug (when selecting option b above)
- Only show subcategories - enable this to only show the subcategories of the selected (when selection option b above)
- Sub Category Prefix (when choosing to display parent and sub) - this will prefix the subcategory to indicate that it is a child
- Make the subcategories collapsible
If you want to have two filters and one be updated based on the selection of the parent categories you can do this.
Step 1: Add Parent Category Filter
Add the parent category filter.
1) Define it to ONLY show parent categories
2) Set the Conditional ID and Name to what you want
Step 2: Add a Subcategory Filter
1) It does not matter what type you set it to - just have it as "show all" for the category display mode
2) Define 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.
Watch a video here to explain more