
Minesh
Supporter
Languages:
English (English )
Timezone:
Asia/Kolkata (GMT+05:30)
Following products are removed with the following product IDs:
Array
(
[0] => 25659
[1] => 21748
[2] => 19799
[3] => 19778
[4] => 16998
[5] => 16996
[6] => 16994
[7] => 16992
[8] => 16990
[9] => 16988
)
When I checked all those products are set as hidden products. Can you please verify and let me know if its not working as expected.
Hi Minesh, the code seems to be working sometimes and not other times.
How can I see the array like you showed in the previous message. This will help me troubleshoot further.

Minesh
Supporter
Languages:
English (English )
Timezone:
Asia/Kolkata (GMT+05:30)
within the code I shared:
add_filter( 'wpv_filter_query', 'func_filter_hidden_products',10,3 );
function func_filter_hidden_products( $query_args,$views_settings, $view_id) {
if ($view_id == 14162) {
$args = array(
'visibility' => 'hidden',
'return' => 'ids',
);
$products = wc_get_products( $args );
echo "<pre>";
print_r($products);
exit;
if(!empty($products)){
$query_args['post__not_in'] = $products;
}
}
return $query_args;
}
I've added the following debug code as you can see with the above code:
echo "<pre>";
print_r($products);
exit;
It will return you the product IDs, you can debug with this and check once you done with debug you should remove the above debug code.