Does anyone know how I can customize the WooCommerce price filter widget to filter on a ‘change’ trigger instead of having the submit button?
It is located in templates/content-widget-price-filter.php – but since it is made as a form, does that mean I HAVE to use a submit button to trigger the event?
3
Answers
In your child theme, you could create a jQuery script that detects a click on the slider to automatically click on the "Filter" button.
Then just hide the filter button in your css (can can do that in jQuery if you prefer):
Tested and it works 🙂
The accepted answer works but it can be improved. For example, it submits the form even if a user clicks on the filter without changing the price range.
WooCommerce triggers some filter-related events, so we can submit the form only when necessary:
Of course, the submit button still need to be hidden 🙂
None of these jquery solutions worked for me so here what I did may be it will help someone.