Navigation überspringen

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

This support ticket is created vor 3 years, 1 month. There's a good chance that you are reading advice that it now obsolete.

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.

Dieses Thema enthält 1 reply, hat 2 Stimmen.

Zuletzt aktualisiert von Christopher Amirian vor 3 years, 1 month.

Assistiert von: Christopher Amirian.

Author
Artikel
#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
Unterstützer

Sprachen: Englisch (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:

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