Whereas the normal shop pages filter correctly, I'm working with a plugin (Woo Product table). it still shows products and product categories that are set invisible to the group/user by B2B-king. This is why I want to make the selecting query compatible with the B2B visibility feature.
Can you please assist me by implementing this selection query which:
Only selects products which are
1. are set visible to the current B2BKing user (on a product level)
2. are within a category which is visible to the current B2BKing user
It probably looks something like this:
if ($b2b_king_user) {
//filter out categories invisible to user or user's group (set in category)
$args['tax_query']['product_cat_invisible'] = array(
'taxonomy' => 'product_cat',
'field' => 'id',
'terms' => $cat_ids_hidden_to_current_user,
'operator' => 'NOT IN'
);
//filter out products invisible to user or user's group (set in product)
$args['post__not_in'] = $product_ids_hidden_to_current_user;
}
