<?php
add_action( 'facetwp_scripts', function() { ?>
<script>
document.addEventListener('facetwp-refresh', function() {
let facet_name = 'categories'; // change 'categories' to name of facet change 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 );