apply_filters( 'relevanssi_woocommerce_indexing', array $woocommerce_blocks )

This filter controls the WooCommerce indexing restrictions in Relevanssi.


(array) An array with three keys: ‘outofstock’, ‘exclude-from-catalog’, and ‘exclude-from-search’. These are the three product visibility settings from WooCommerce. You can set these to true to filter posts in indexing.

More information

WooCommerce has three levels of limited product visibility. You can set products to be “out of stock”, “excluded from the catalogue”, and “excluded from search”. By default, Relevanssi indexes “out of stock” and “excluded from catalogue” products, but not “exclude from search” products. You can control this behaviour with this filter hook.

For example, to exclude all of these posts from the index, use:

add_filter( 'relevanssi_woocommerce_indexing', 'rlv_woocommerce_filter' );
function rlv_woocommerce_filter( $blocks ) {
    $blocks['outofstock']           = true;
    $blocks['exclude-from-catalog'] = true;
    $blocks['exclude-from-search']  = true;
    return $blocks;

Since this is an indexing filter, it only works when indexing products. So, after making changes to the filter, you need to reindex all posts.