Overview
Did you know that Gravity Forms provides a shortcode to display different content based on what the user has entered in their submission? If not, check out our Gravity Forms Conditional Shortcode article for an overview how it works. Afterwards, hop back into this article to learn how to get the most out of it.
One limitation of the built-in shortcode is that it only allows for a single condition. If you wanted to display content based on the values from multiple fields, until recently the only solution has been to use multiple shortcodes. At best, it’s a clunky solution, and at worst it’s a headache to troubleshoot.
To solve this problem, we built a plugin that adds support for including multiple conditions in a single shortcode. This will not only save you time, but it gives you the freedom to display content using complex conditional logic in Confirmations, Notifications, and anywhere else shortcodes are supported.
Using the Plugin
Prerequisites
Confirm that you have Gravity Forms installed and activated and that you’ve installed and activated the plugin.
Using the Shortcode
Gravity Forms Advanced Conditional Shortcode adds additional parameters to the [gravityforms]
shortcode to allow for multiple conditions. Let’s step through an example scenario.
Say you run a store that sells accessories for cars and trucks, and you want to offer specific products to your customers on the Confirmation page based on choices they make in the form.

Using Advanced Conditional Shortcodes, you can target specific combinations to display content.
In this example, if a customer selects both “SUV” and “Off-road” they’ll see a message about off-road accessories. Any other combination only displays the default message.

Parameters
Advanced Conditional Shortcodes supports all of the parameters in the vanilla Gravity Forms Conditional Shortcode with the addition of the following.
- relation (string) (required)
The type of relation between the different conditions. Possible relations include:- all
- any
- value (string) (required)
Specify the merge tag to be evaluated by the operator and the compare.
You can find a full list of form-specific merge tags while editing a Notification or Confirmation under the merge tag button: - operator (string) (required)
Enter the operator to be used to test the content of the merge tag with the value you specify. Similar to the condition parameter in the vanilla shortcode, but specific to Advanced Conditionals. Possible conditions include:- isnot
- is
- greater_than
- less_than
- contains
- starts_with
- ends_with
- compare (string) (required)
The value that will be compared against the value based on the operator.
Unlimited value, operator, and compare parameters can be added to the conditional shortcode. Simply add a number to the end of each of the parameters to group them together. For example, a second group looks like this:
value2="{:2}" operator2="is" compare2="Off-road"
Taking It Further
Same as the standard Conditional Shortcode, the Advanced Conditional Shortcode will work in HTML fields when using Gravity Forms Preview Submission. The same is true for using Advanced Conditional Shortcodes in post content via GF Post Content Merge Tags. More info in our Gravity Forms Conditional Merge Tags article.
Did this resource help you do something awesome with Gravity Forms? Then you'll absolutely love Gravity Perks; a suite of 32+ essential add-ons for Gravity Forms with support you can count on.
Leave a Reply