How to exclude categories from the search?

The categories terms are displayed in live search when the “Show categories” option is enabled:

It’s possible to exclude certain categories from live search. The solution requires custom PHP snippets. To do it, you have to paste the following code into functions.php in your child theme or use the Code Snippets plugin.

To implement the code correctly, you have to know the IDs of the categories you want to exclude. You can read the category ID from the URL when you are on the category edit page.

Custom code

add_filter('dgwt/wcas/search/product_cat/args', function ($args){

    $args['exclude'] = array(999, 1000, 1001); // The ID of categories to exclude

    return $args;
});

If you use the Pro plugin version, remember to rebuild the search index after implementing the code. To do it, go to WooCommerce -> FiboSearch -> Indexer (tab) and click the “Rebuild index” button.