Liquid Guide: Using the 'Condition' code block

  • Updated
Description

To find the 'Condition' code block, select an element and scroll all the way to the bottom in the right hand navigation.

 

Using the Condition section of an element allows you to show / hide certain elements based on the value of a field or variable. As with the Setup block (guide here), the Condition can only be used in the element where the logic is set, or within its child elements.

Customer object fields can be referenced anywhere in Conditions.

Data stored in variables can be referenced as long as:

    • The query is stored in the Variables section, or;
    • The query is stored in the same element as the Condition, or;
    • The query is stored in a parent element of the Condition.

 

 

Examples:

 

This element will only show if the user’s first_name field is not blank:

 

This section will show if ‘b_data’ is not empty:

 

 

This section will show if the ‘name’ of the first record returned in b_data contains ‘Denim’:

 

 

Note: 'and’ or ‘or’ clauses can be used to check for more than 1 condition.

 

This element will only show if the user’s first_name and last_name are not blank:

 

Additional Resources