Hi @metacofleurcom,
I understand this issue is causing you trouble, and you’d like it resolved. While the case is still open, a temporary workaround is to add a filter that excludes products marked as hidden from search results.
You can try the following code and let me know if it works for you:
function exclude_hidden_products_from_search($query) {
if (!is_admin() && $query->is_search() && $query->is_main_query()) {
$query->set('post_type', 'product'); // Ensure only products are searched
// Exclude hidden products using the WooCommerce taxonomy
$query->set('tax_query', array(
array(
'taxonomy' => 'product_visibility',
'field' => 'slug',
'terms' => 'exclude-from-search',
'operator' => 'NOT IN',
),
));
}
}
add_action('pre_get_posts', 'exclude_hidden_products_from_search');
Additionally, you may find this solution helpful:
Stack Overflow: Remove WooCommerce Hidden Products from WordPress Default Search