This code enables you to control which user roles can purchase products from specific product categories. If the user role & product category are not included, the add to cart button is removed from all page types. Product from all other categories are available for purchase by default.
What’s Included
- 1 year code updates
- Free installation & setup for absolute beginners
- A custom function for WooCommerce which works with any WordPress theme.
- Add your role or a comma separated list of roles to line 13
- Add your category or comma separated categories to line 15
Installation
Copy & paste the PHP code from functions.php to the end of your child themes or custom functionality plugin and add your role(s) and category slug(s) to the code.
You must be logged in to post a comment.