Looking for a plugin that helps me to restrict woocommerce products or product categories based on role.
Let’s say that I only want to sell bulk products to whole sale buyers.
Any help is awesome, thanks!
Looking for a plugin that helps me to restrict woocommerce products or product categories based on role.
Let’s say that I only want to sell bulk products to whole sale buyers.
Any help is awesome, thanks!
Comments are closed.
Here is how I managed to hide products based on role:
First, I have added a checkbox in the product options inventory section to enable admins to hide the products based on their selection:
I then saved this selection in the actual post when a post is updated.
This is how I got current user’s role.
Now query products. If the current user role matches the roles below, show the products as usual.
Otherwise, set the query based on the code above…
To achieve this you can use the Free Groups plugin. But for that you must add all the wholesalers to one group say wholesale group 1. Then while editing any product you get an option to access to, add the wholesaler group 1 there. The product will now be only seen by the user who is in wholesalers group 1.
I tried a few different plugins to try to achieve that. I finally chose this one because it’s easy to understand and can show/hide depending on procucts, tags, categories and custom taxonomies. WooCommerce Products Visibility