How to exclude hidden products?
-
Hi,
I’m running a shop with WooCommerce and some of the products are set to get hidden from the search and the catalog.
Together with your support I created this filter:function fws_exclude_hidden_products( $should_index, WP_Post $post ) { if ($product = wc_get_product( $post->ID )) { $visibility = $product->get_catalog_visibility(); if ( $visibility == 'hidden' ) { $should_index = false; } } return $should_index; } add_filter( 'algolia_should_index_searchable_post', 'fws_exclude_hidden_products', 10, 2 );
This code should exclude those products, but it doesn’t.
Any idea what might be wrong?
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘How to exclude hidden products?’ is closed to new replies.