Skip Navigation

[Resolved] How to restrict access to a page/post based on product purchased and variation

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 1 reply, has 2 voices.

Last updated by Christopher Amirian 1 year, 9 months ago.

Assisted by: Christopher Amirian.

Author
Posts
#2601073

How to restrict access to a page/post based on product purchased and specific variation of that product.

For example, page A may only be accessed by someone that purchased product A and variation A1

#2601193

Christopher Amirian
Supporter

Languages: English (English )

Hi there,

That is not possible with Toolset built-in features. You need custom development for that.

What you need is to use the "wc_get_orders" WooCommerce to be able to get the list of the orders:

hidden link

Then you need to loop through the orders that have the Producst A with Variation B and extract the users that have have that kind of order.

Now that you have the user list you need to assign a custom role to those users. The custom role is what you have created already in Toolset Access.

Then you can restrict the pages using that custom role.

The process needs extensive knowledge of the WooCommerce Hook API and PHP WordPress development.

You are welcome to hire a developer to do that:

https://toolset.com/contractors/

Thanks.