Automatically expand all top-level terms

mgibbs189

{{gist file=”functions.php” lang=”php”}}
<?php

// Add to your (child) theme’s functions.php file

add_action( ‘wp_head’, function() {
?>
<script>
(function($) {
$(document).on(‘facetwp-loaded’, function() {
$(‘.facetwp-facet-product_categories > .facetwp-checkbox .facetwp-expand’).each(function() {
if (‘[+]’ == $(this).text()) {
$(this).click();
}
});
});
})(jQuery);
</script>
<?php
}, 100 );

{{/gist}}