-
-
Save raphaelkross/f3fa36d856095bc0d91da306c28d4c68 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function fwp_preload_facets() { | |
?> | |
<script> | |
(function($) { | |
$(document).on('facetwp-refresh', function() { | |
if (! FWP.loaded && '' == FWP.build_query_string()) { | |
FWP.facets['product_availability'] = ['americas'];] | |
FWP.refresh(); | |
} | |
}); | |
})(jQuery); | |
</script> | |
<?php | |
} | |
add_action( 'wp_head', 'fwp_preload_facets', 100 ); | |
add_filter( 'facetwp_template_force_load', '__return_true' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment