How do you check if a custom field exists on an email blast? I want to show conditional content to folks with certain custom field values, and show something else to those that don't have them.
You can totally do this! If you wanted to check whether a custom field existed in an email blast, you would create a conditional liquid snippet that first checks for an empty string in the field or else checks for anything that is not empty (not blank in this case):
{% if recipient.custom_values_for_display['custom_field_slug'] == blank %}
NO SPECIAL CONTENT
{% else %}
SPECIAL CONTENT
{% endif %}
The else in this case would contain the SPECIAL CONTENT code, or the existence of values in the custom field. Whereas the if statement checks for nil or empty content using "blank". Finally, you would be able to show special content after the else where it reads "SPECIAL CONTENT".
Showing 1 reaction
Sign in with