Reputation: 33
I am currently attempting to prevent users from being able to see products and categories based on their role on my WordPress site with WooCommerce. Is there a recommended plug-in or change in the code I can implement to solve this issue?
Background: This site sells products (wholesale/retail). Users with increased privilege are able to purchase certain items that retail users/visitors will not be able to see.
I have been able to accomplish the effect where the items are hidden using the plugin Booster: Product Visibility by User Role; however, the categories with their respective pictures still appear and results are still counted.
Are there any other suggested plugins that accomplish this? Or is there an option in Booster that I am missing?
Thank you for your help in advance. :)
Upvotes: 0
Views: 532
Reputation: 1
This is super old now but still not answered well. I noticed you said Booster - I checked and Booster now (2024) does have role-based visibility for products as one of their features.
That said I still don't see a clear answer on how to achieve this without purchasing a plugin like Booster.
Upvotes: 0
Reputation: 1005
You can check the user role and display appropriate content like this:
<?php if( current_user_can('editor') ) :
// display content for editors
endif ?>
Upvotes: 0