I have created a woocommerce product search.
I use dropdowns of different taxonomies to filter my Products.
I would like to reset all filters when selecting the default option of my first select field.
Hello and thank you for contacting the Toolset support.
I am not sure to fully understand your question. I might need to know what the first filter is? And maybe how your view is created?
But I'll still give it a try. I think this may be possible with custom Javascript code, added to the view, that will listen for events changes on the first filter and check its value, if it is equal to the first value, it may trigger a reset of the form and set the value for the filter(because it will be empty after reset).
hidden link
A code similar to:
jQuery(function($){
$('select[name=category]').on('change', function(){ // you may need to adapt "select[name=category]" depending on your form
var select = $(this); // get a jquery object around the select field
var value = select.val(); // get the value of the select filter
if (value == 'first-select-value') { // check the value against our desired value
select.parent('form').trigger('reset'); // reset the form
select.val(value); // set the value again for the filter as it will be reset
}
})
})
If you have any doubts about this solution, please allow me temporary access to take a closer look at your form. Your next reply will be private to let you share credentials safely. ** Make a database backup before sharing credentials. **