facetwp select and refresh after loaded

djrmom

{{gist file=”custom-hooks.php” lang=”php”}}
<?php

function fwp_preload_facets() {
?>
<script>
(function($) {
$(document).on(‘facetwp-loaded’, function() {
if ( ” == FWP.build_query_string() && ‘shop’ == FWP_HTTP.uri) {
FWP.is_reset = true;
FWP.facets[‘product_categories’] = [‘clothing’];
FWP.refresh();
}
});
})(jQuery);
</script>
<?php
}
add_action( ‘wp_head’, ‘fwp_preload_facets’, 100 );
{{/gist}}