Code snippet: Hiding categories from the wholesale store page
WooCommerce Wholesale Pro has built-in visibility options which you can use to mark each product category as Public, Wholesale Only or Both.
We have created the following code snippet for customers who want to create categories which logged in wholesale can access, but which are hidden from the main wholesale store page. Please note that code snippets are aimed at developers. If you feel comfortable using them, our article on how to use code snippets can serve as a helpful guide. However, if you don't feel comfortable using them, then you should ask your developer or use our plugin customization service.
function exclude_category_from_archive( $tax_query ) { $tax_query[] = [ 'taxonomy' => 'product_cat', 'field' => 'term_id', 'terms' => [ 26, 61 ], 'include_children' => true, 'operator' => 'NOT IN', ]; return $tax_query; } add_filter( 'wcwp_store_query_tax_query', 'exclude_category_from_archive' );
If searching the knowledge base hasn't answered your question, please contact support.