Restrict viewing a specific product page to a certain member role

Question:
How do I restrict the product pages of specific products to only be viewable by certain members with given role?

Product:
Wix Studio

What are you trying to achieve:
I want the product pages of about 5-10 products to be viewable only by members with a given role. I do not want the other product pages to be affected.

What have you already tried:
I have two shops, one with every product except 5-10. Those same 5-10 products are only visible on the 2nd shop page. The 2nd shop page has restrictions to members with the desired role, however if someone is given a direct link to a product in the 2nd shop or clicks on the direct link from a Google search, it allows the person to add and purchase the product because it bypasses the 2nd shop page restrictions.

Additional information:
I do not want to limit SEO by removing these products, I rather have a gating function that allows the viewer to go to the product page, but won’t all them to add it to cart or will pop up a light box for only those products, or similar modal that gates the user from adding to cart and purchasing.

Hey there,

By shop page, I believe you are referring to Category page?

If so, yes if provided with a direct link to the product page, any user bypass the Category page restrictions, and can add the restricted product to their cart and checkout regardless of their role.

So in order to make this work, you will need to add custom code using Velo directly to the product page itself, which will check the user’s role and only users with the necessary permissions will be allowed to view / purchase the restricted products.

The category page as I’m aware, is the new look/formatting. We are still on the older shop pages still. It currently asks us if we want to migrate to a category page for our store pages.

Yes, Wix support informed us that custom code would be required and suggested we post here. We are looking for support or references to do as you’re suggesting. Not sure how to apply this code only to specific products and to perform this check. Any help is appreciated, google/youtube search hasn’t given us anything so far.

You would need to create a database to reference the member role specific products.

You can read/lookup the Wix API docs to learn how to retrieve a role, how to search your database, etc.

If you are looking to hire someone to write the logic and the code for you, I am available.

#codequeen