Hey guys, how do I disable a categories visibility to B2C customers and only show to a specific B2B group? After setting all the below settings, the PRODUCT is hidden from B2C customers however, the CATEGORY is still showing to B2C customers? See screenshot attached. I want to hide it from them.
While the plugin can hide products, it can't hide menu items natively. One solution would be to hide these via CSS by adding a specific snippet.
In the snippet below you would have to replace cat-item-7922 with the class of your category.
// Apply CSS for B2C and Logged Out users only
add_action('wp_head','b2c_only_css');
function b2c_only_css(){
// check that user is not B2B
if (get_user_meta(get_current_user_id(), 'b2bking_b2buser', true) !== 'yes'){
?>
<style>
.cat-item-7922{
display:none;
}
</style>
<?php
}
}
HI, can you tell me where in Wordpress I am to post the snip-it of code below to hide the category? and where i can find what the cat-item-### is for the category I am trying to hide?
Hey guys, how do I disable a categories visibility to B2C customers and only show to a specific B2B group? After setting all the below settings, the PRODUCT is hidden from B2C customers however, the CATEGORY is still showing to B2C customers? See screenshot attached. I want to hide it from them.
All products Visible: Off
Enable Hidden has Priority: On
Guest Restriction: Hide shop & products
Plugin Status: B2B & B2C Hybrid
Category Settings are attached as screenshot.
Hi Kyle,
Thank you for purchasing our plugin.
While the plugin can hide products, it can't hide menu items natively. One solution would be to hide these via CSS by adding a specific snippet.
In the snippet below you would have to replace cat-item-7922 with the class of your category.
Kind Regards,
Stefan
HI, can you tell me where in Wordpress I am to post the snip-it of code below to hide the category? and where i can find what the cat-item-### is for the category I am trying to hide?
Hi Steph,
The bellow snippet is a PHP snippet. To add that to your site, kindly please follow the instructions in this article:
https://woocommerce-b2b-plugin.com/docs/how-to-add-a-snippet-php-or-js/
To get the ID of your category, you can go in the backend to Products -> Categories and click on the category:
The number in the link is the category ID:
in the above example it is 15. Therefore, the class would be '.cat-item-15'
Let me know if I can help,
Kind regards,
Stefan