facetwp redirect category selection

djrmom

{{gist file=”facet.js” lang=”javascript”}}
(function($) {
$(document).on(‘facetwp-refresh’, function() {
if ( ‘fr/accueil’ == FWP_HTTP.uri && ‘undefined’ !== typeof FWP.facets[‘categories’] && FWP.facets[‘categories’].length > 0 ) {
var query = FWP.build_query_string();
window.location.href = ‘/search-results/?’ + query;
}
});
})(jQuery);
{{/gist}}