Set a class for the parent choice if the child options are visible in a hierarchical Checkboxes facet

<?php
// This sets the class "checked", which makes the parent choice look selected, with a checked checkbox icon.
// If you just want to make the parent choice bold for example, use a custom class, e.g. 'selected', and add CSS to make it bold:
// .facetwp-checkbox.selected { font-weight: bold; }

add_action( 'facetwp_scripts', function() {
  ?>
  <script>
    (function($) {
      document.addEventListener('facetwp-loaded', function() {
        $('.facetwp-depth.visible').prev('.facetwp-checkbox').toggleClass('checked');
      });
    })(jQuery);
  </script>
  <?php
}, 100 );