Conditional Shortcode ... Two Conditions?

Hey all, wondering if there’s a way to have two conditions be met in a conditional shortcode ? i.e.

[gravityforms action="conditional" merge_tag="{Field:22}" condition="is" value="Yes"]Cutting calories: <span class="answer">{Field:72}</span>[/gravityforms]

vs TWO conditions

[gravityforms action="conditional" merge_tag="{Field:22}" && merge_tag="{Field:20}" condition="is" value="Yes"]Cutting calories: <span class="answer">{Field:72}</span>[/gravityforms]

Thanks

That is not currently possible I’m afraid. You can have one conditional shortcode, then use conditional logic on the notification, so that you can ensure the correct information is sent only when both conditions are met. That does mean you’ll need to create an alternate notification for when one of the conditions is NOT met. Would that work for you?

If not, there is a plugin that can perform some advanced conditional logic, but I don’t believe it works in the conditional shortcode. It could be used with the notification itself though:

https://mcdonnell.nz/product/gravity-forms-advanced-conditional-logic/

Thanks Chris. I’ll work on wrapping my head around that … that should work.

If anyone is following, I also had response from support…another option:

"Hi Paul,

I’m afraid it is not a feature of the plugin, but there is a workaround. Fields that are hidden by conditional logic return zero in calculation formulas and that can be used for complex conditional logic:

- Create a number field with a default value of 1, set it to hidden and set its conditional logic to show if field 54 is not blank
- Create a number field with a default value of 1, set it to hidden and set its conditional logic to show if field 20 is not blank
- Create a number field with calculation enabled and make it sum up the fields above
- Use conditional shortcode to check the calculation value - if it is equal to 2, both fields 20 and 54 are not empty"

That works too. There’s always a way.

1 Like