Skip to main content

Hi,

I am having issues understanding IF/ELSE statements for email.

I went through an article and a few questions on here about syntax and IF/ELSE statements. They used the person|lookup variable.

Example:

{% if person|lookup:'Interested in Dogs?' and not person|lookup:'Interested in Cats?' %}  

 Like dogs? Check out some great toys for your canine.

{% elif person|lookup:'Interested in Cats?' and not person|lookup:'Interested in Dogs?' %}  

 Like cats? Check out some great toys for your feline.

{% else %}

Check out some great toys for your pet!

{% endif %}


My question: Would it be possible to use IF/ELSE statements to pull IF a user has a listed item in their cart pull the description or list x,y,z benefits, or If they have a different item to list the benefits of the other item? |

What would the best example of using IF/ELSE statements like this (using to show the benefits of a product a user has left at checkout) be or is there a youtube that would show other ways to use IF/ELSE statements?


Thanks,

Hi @B Mo, welcome to the community!

Perhaps you were looking at one of my articles, your code looks a bit familiar. :)

My article has a few other hypothetical examples, but generally speaking you can use the IF / ELSE to Show/Hide Blocks or even whole sections of Text (or HTML) whenever you want to condtional adjust the template based on a Custom Property or an Event Variable.

For your specific example, you can certainly have an IF/ELSE or a Show/Hide of certain blocks of benefits based on what it is in the cart.  It might be tedious to do this if you have a lot of different items in the store, so I recommend using the products’ category/collection or tags - that way you can organize your products accordingly and map these various IF/ELSE or Show/Hide blocks to groups of items. 

Hope this helps!


Thanks!

Again you’ve been super helpful!


Reply