How does the logic of the filters work?
WooCommerce Product Filters uses advanced logic to ensure that customers always see relevant results and can find what they're looking for quickly and easily.
This page provides more information about how the plugin works behind the scenes.
Products are retrieved using the following logic:
- Individual filters - 'OR' logic is used when you select multiple options within an individual filter. For example, if you select 'Blue' and 'Red' then all products which are either blue OR red are shown.
- Separate filters - 'AND' logic is used across multiple filters. For example, if you select 'Blue' from one filter and 'Large' from another then all products which are both blue AND large are shown.
Only valid products and options are shown
If the customer is on the Shop page then the filters will display all products in the store. If the customer is within a specific part of the store (e.g. a product category page, or a page listing specific products only created using a plugin such as WooCommerce Product Table or Elementor) then the filters will only display products from the current page. For example:
- If there are 10 color attributes in the overall store but only 5 apply to the products on the current category page, then only these 5 colours will appear.
- The price slider will always show the low-high price for the current products, regardless of the price of other products in the store.
All filters which would yield no results are hidden automatically. This includes:
- Individual terms - e.g. the ‘blue’ attribute.
- Entire filters - e.g. if there is a ‘Color’ filter but none of the products use this attribute then the filter will be hidden; or if there are no ‘Out of stock’ products then the stock toggle will be hidden.
- Entire filter groups - e.g. if you have added a filter group but none of the filters would have results, then it shouldn’t appear at all.
Note: This only applies when the page first loads. Once the customer has started using the filters, it would be strange to suddenly hide certain filters when no results are available. Instead, the product count changes to 0 and the unavailable filters change to become inactive/greyed out in this scenario.
In addition, the ‘Uncategorized’ category filter is always hidden, even if it has products in it. This is because it doesn't look professional and we would always recommend adding proper categories for your products.
Filters are listed hierarchically
If you have created a multi-level parent/child structure for your categories or hierarchical taxonomies, then the filter options will be nested hierarchically. This allows customers to see the correct structure so that they can select filter options more logically.
The filters are inter-dependent
The filters are dependent on each other so that when you make one selection, the options in the other filters update so that only what is available appears. The count which appears next to each product will also update.
For example, let’s say that you have 'Color' and 'Size' filters and the Large size is only available in Blue. When you select Red, Large will disappear from the Size filter.