<?php
/** reset a facet (facet 2) on submission of different facet (facet 1)
** change 'search' to name of facet 1
** change 'product_categories' to the name of the facet 2
**/
add_action( 'wp_footer', function() {
?>
<script>
(function($) {
$(document).on('facetwp-refresh', function() {
if ( 'undefined' !== typeof FWP.facets['search'] && FWP.facets['search'].length < 1 ) {
FWP.facets['product_categories'] = [];
}
});
})(jQuery);
</script>
<?php
}, 100 );