Embed Snippet on Your Site
WWPP – Restrict add-to-cart on specific products to a specific wholesale role only
How to use and configure this snippet:
1. Set your exact Role Key: In the snippet, I used 'doctors'. Please ensure this matches the exact Role Key of your doctors role (you can find the exact key in WooCommerce → Wholesale Roles).
2. Set your Category Slug: I used 'doctors-only'. Create a category for these restricted products and place its slug here. Any product assigned to this category will be restricted.
3. Add the code to your site: We highly recommend adding this code using a free plugin like Code Snippets. This is much safer than editing your theme's functions.php file directly and ensures the code isn't lost during theme updates.
Once applied, regular users or other wholesale customers will still see the product, but the "Add to Cart" button will be removed, and they will not be able to purchase it.
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
Comments