Filtering by custom field
The WooCommerce Product Filters plugin comes with a custom field filter, which you can use to display the following single choice custom fields as filters:
- Radio buttons
- Dropdown/select lists (single value only, does not support multiple choice dropdowns)
- True/false
- TextNumber
You can display these using the following filter styles: Dropdown, Checkboxes, Radio buttons, Range slider and Text input.
This article explains how custom field filters work, and how to create the custom fields.
How to create custom fields
The custom field filter in WooCommerce Product Filters works with custom fields created using Advanced Custom Fields (free or pro, 5.0 or later). You can use it to add a wide range of custom fields to the 'Products' post type. The custom field filter supports the following field types: radio, select, true/false, text, and number. For true/false custom fields, the Filter type dropdown is hidden so that the filter always appears as radio buttons.
Text input custom field filters
You can choose to display custom field filters as a text input field, where the customer types a keyword in order to filter the list of products. For example, if you are using a custom field to store a reference number for each product, then the customer can enter a reference number. Text input filters work with custom fields created with Advanced Custom Fields (5.0 or later). Customers type any part of the field value, so 'AB12' finds 'AB12-RED'.
For best results, if you're displaying custom field filters as a text input search box, then we recommend enabling the button click filter mode. This is because if you use the default AJAX method for your filtering, then the list of products will start updating as soon as the customer starts typing into the search box, which might look strange. With this type of filter, it's better for the customer to click an 'Apply Filters' button after they have finished typing.