<?php
// https://facetwp.com/help-center/developers/javascript-reference/facetwp-refresh/#reset-all-other-facets-on-change-of-a-specific-facet
add_action( 'facetwp_scripts', function() { ?>
<script>
document.addEventListener('facetwp-refresh', function() {
let facet_name = 'my_facet_name'; // Change 'my_facet_name' to the name of the facet that resets other facets.
if ( null !== FWP.active_facet && facet_name == fUtil(FWP.active_facet.nodes[0]).attr('data-name' ) ) {
let others = FWP.facets;
Object.keys(others).forEach(function (key) {
if ( facet_name != key ) {
FWP.facets[key] = [];
}
});
}
});
</script>
<?php }, 100 );