<?php
/** close flyout on facetwp-loaded so that the user doesn't need to close after facet refreshes **/
add_action( 'facetwp_scripts', function() { ?>
<script>
(function($) {
document.addEventListener('facetwp-loaded', function() {
if (FWP.loaded && $('.facetwp-flyout').hasClass('active') ) {
FWP.flyout.close();
}
});
})(fUtil);
</script>
<?php } );