FacetWP – redirect on autocomplete selection

mgibbs189

{{gist file=”test.js” lang=”javascript”}}
<script>
(function($) {
$(document).on(‘facetwp-loaded’, function() {
if (1 === FWP.settings.pager.total_rows && 0 < FWP.facets[‘the_search’].length) {
$(‘.facetwp-template a:first’).click(); // click the first hyperlink
}
});
})(jQuery);
</script>
{{/gist}}