Skip Navigation

[Resolved] Conditional output based on cart input : repost

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.

This topic contains 2 replies, has 2 voices.

Last updated by Pat 2 years, 8 months ago.

Author
Posts
#2323689

Pat

Hello,

I'm coming back to one of my previews ticket (https://toolset.com/forums/topic/conditional-output-based-on-cart-input/).
Nigel explained (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).
I would like to know what should be the result of this function to be used inside a Toolset conditional. Should it be a true / false result or something else? When used in a conditional in general, what is the expression that the condition is waiting for (in order to built the function returning exactly this expression).

Regards
Pat

#2323819

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Pat

Your function can return whatever you want, and then the condition tests whether what is returned by the function matches some value you specify.

It's not easy to handle boolean true/false values in this way, and typically you would do something like return 1 or 0 (for true or false).

#2326767

Pat

Got it.
Thanks Nigel.
Regards
Pat