Redirect when a facet is interacted with

mgibbs189

{{gist file=”test.js” lang=”javascript”}}
<script>

(function($) {
$(document).on(‘facetwp-refresh’, function() {
if (FWP.loaded && ” == FWP_HTTP.uri) { // if not the initial pageload, and we’re on the homepage
window.location.href = ‘/listings/?’ + FWP.build_query_string(); // redirect
}
});
})(jQuery);

</script>
{{/gist}}