This support ticket is created 2 years, 8 months ago. 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.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
I need to use a conditional output (in order to display or not the BUY button on specific pages). This conditional output is based on one of these 2 conditions (OR) :
1. The user is connected and has a specific role => no issue for that
2. The user is connected and a product of a specific category (inscription) has been placed on the cart (but the cart validation has not been done).
Can you help on how to setup the second part of the condition?
Regards
Pat
You'll need to write a custom function to check if a product is in the cart, and you can then use the results of that function in your condition. (Don't forget to register the custom function at Toolset > Settings > Front-end content.)
I don't find the WooCommerce API docs very easy to navigate, but I found this article about retrieving the cart which shows how to get the cart contents and loop through them: hidden link
For each product you can check if it has the product category assigned you are concerned with.