1. Home
  2. Knowledge Base
  3. WooCommerce Wholesale Pro
  4. Advanced Usage

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 this is aimed at developers and if you don't know how to use it then you should ask your developer or post a job on Codeable to find someone who can do it for you.

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' );
We've partnered with Codeable to provide our customers with expert help if required.

Related Articles

If searching the knowledge base hasn't answered your question, please contact support.