If Conditional Logic

New Contributor

I am trying to write if/else logic in an email:

-If a custom property is null show nothing

-Everything else show XX

 

I tried testing it with both of the following formats and a few others and I'm not sure what I'm missing:

 

{% if custom.orderPromoCodeDeduction='null' %} 

Null

{% else %}
Other
{% endif %}

 

{% if custom.orderPromoCodeDeduction == 'null' %} 

Null

{% else %}
Other
{% endif %}

 

Is there a format I should be using?

Reply
0 Upvotes
2 Replies 2
Regular Advisor | Platinum Partner

@dmsacco1011

{% if custom.orderPromoCodeDeduction %} 

//content for if it exists

{% else %}

//content if it doesnt

{% endif %}

remove the null

 

here is a reference

 

dennis
Highlighted
New Contributor

I was attempting this in the single send transactional emails. Which does not support conditional logic. 

Reply
0 Upvotes