Display products for each user role

[ad_1]

Hi @dinhtrong

Thank you for reaching out to Paid Memberships Pro.

Can you please tell me what products you are referring to? Is this through WooCommerce or another e-commerce plugin?

If you’re using WooCommerce here is a custom code snippet that you may use to filter your store based on the user’s membership level – https://gist.github.com/andrewlimaza/d03ecc4441385fa40debdc73ceb2d569

Please note that our support doesn’t cover custom code recipes like the one I shared, as it may be used for a starting point that a developer may be able to work from to customize your site further.

I hope this helps get you started.

hi @andrewza ,

thank you.

I using WooCommerce, my idea is quite simple, I just want each product to be visible for each user role.
For example:
T shirt, only visible when the silver user is logged in.
Hat is only visible to gold users
can I do this without custom code?

Thanks

Hi @dinhtrong

This wouldn’t be possible without custom code. Making use of the code recipe @andrewza shared should get you started though – you would need to adjust parts of the code that hooks into the woocommerce_product_query filter to reference a product ID instead of product categories and work from there.

Thank you. great support. I will do it the way you mentioned

thanks,

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer