# Restrict viewing a specific product page to a certain member role

**URL:** <https://forum.wixstudio.com/t/restrict-viewing-a-specific-product-page-to-a-certain-member-role/63307>\
**Category:** Ask the community\
**Tags:** wix-members-area, question, code, seo\
**Created:** [October 5, 2024, 5:47am UTC](https://forum.wixstudio.com/t/restrict-viewing-a-specific-product-page-to-a-certain-member-role/63307 "2024-10-05T05:47:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![VanderPlan\_Consultin](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/vanderplan_consultin/32/97892_2.png) [@VanderPlan\_Consultin](https://forum.wixstudio.com/u/VanderPlan_Consultin)\
**Post date:** [October 5, 2024, 5:47am UTC](https://forum.wixstudio.com/t/restrict-viewing-a-specific-product-page-to-a-certain-member-role/63307/1 "2024-10-05T05:47:27Z")

</div>

**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.

---

<div class="post-metadata">

**Author:** ![Pratham](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/pratham/32/119586_2.png) [@Pratham](https://forum.wixstudio.com/u/Pratham)\
**Post date:** [October 5, 2024, 7:36am UTC](https://forum.wixstudio.com/t/restrict-viewing-a-specific-product-page-to-a-certain-member-role/63307/2 "2024-10-05T07:36:01Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![VanderPlan\_Consultin](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/vanderplan_consultin/32/97892_2.png) [@VanderPlan\_Consultin](https://forum.wixstudio.com/u/VanderPlan_Consultin)\
**Post date:** [October 5, 2024, 5:42pm UTC](https://forum.wixstudio.com/t/restrict-viewing-a-specific-product-page-to-a-certain-member-role/63307/3 "2024-10-05T17:42:16Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![codequeen](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/codequeen/32/88960_2.png) [@codequeen](https://forum.wixstudio.com/u/codequeen)\
**Post date:** [October 7, 2024, 4:25am UTC](https://forum.wixstudio.com/t/restrict-viewing-a-specific-product-page-to-a-certain-member-role/63307/4 "2024-10-07T04:25:45Z")

</div>

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.

> **[Get Roles | Velo](https://dev.wix.com/docs/velo/api-reference/wix-members-frontend/current-member/get-roles)**
>
> Retrieves the member's roles. The getRoles() function returns a Promise that resolves to the roles of the currently logged-in member. If no member is currently logged in, the Promise is rejected. Notes: - The member data in the resolved promise will...

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

#codequeen
