Skip to main content
Contributor I
December 2, 2023
Solved

Add if condition in my email

  • December 2, 2023
  • 2 replies
  • 348 views

Hello all,

 

I hope someone can help me. I want to add a “if” condition to my email. Let me explain.

 

Below you can see my email text, I want to show “Promotion” line only when someone have used a coupon code. If there is not copupon code, I want to hide it.

Also, I want to add the shipping cost after “Livraison :” but I don’t find this data on Preview data source.

 

Promotion (code : {{ event.extra.discount_codes.0.code|default:'' }}) : -{{ event.extra.discount_codes.0.amount|default:'' }}€

Sous-total : {{ event.extra.current_subtotal_price_set.shop_money.amount|default:'' }}€

Livraison : 

Total : {{ event.extra.current_total_price_set.shop_money.amount|default:'' }}€

dont TVA 20% : {{ event.extra.current_total_tax_set.shop_money.amount|default:'' }}€

 

Vous avez choisi {{ event.ShippingRate|default:'' }} comme méthode de livraison.

 

Also, if I did something wrong don’t hesitate to give me tips

Your help will be very appreciated !

 

Thank you !

 

    Best answer by Taylor Tarpley

    Hi there @Hop

     

    Welcome to the Community! Happy to help! 

     

    If you can’t find the shipping variable in your event data, it could be that your integration isn’t passing this in your placed order metric. Can you investigate your event data again to see if your integration is passing a shipping rate field? If so, you can do something like an if/else statement, for instance if ShippingRate = X then Price $ABC or ShippingRate = Y then $DEF

     

    For the promotion line, you’ll want to either use an if/then statement or a show/hide block. If you can pull your discount variable in your event data, then you can follow our documentation’s format for structuring the code! 

     

    Thanks for participating in the Community!

    -Taylor 

    2 replies

    Taylor Tarpley
    Community Manager
    Community Manager
    December 5, 2023

    Hi there @Hop

     

    Welcome to the Community! Happy to help! 

     

    If you can’t find the shipping variable in your event data, it could be that your integration isn’t passing this in your placed order metric. Can you investigate your event data again to see if your integration is passing a shipping rate field? If so, you can do something like an if/else statement, for instance if ShippingRate = X then Price $ABC or ShippingRate = Y then $DEF

     

    For the promotion line, you’ll want to either use an if/then statement or a show/hide block. If you can pull your discount variable in your event data, then you can follow our documentation’s format for structuring the code! 

     

    Thanks for participating in the Community!

    -Taylor 

    Contributor I
    May 28, 2025

    hello, we want to use the same feature but define the IF condition based on the EVENT info and not the profile info, For example: If person purchased product A in this specific purchase event, then display Z 

     

    Is it possible?

    Thanks