Solved

Add if condition in my email

  • 2 December 2023
  • 1 reply
  • 92 views

Badge
  • Contributor I
  • 0 replies

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 !

 

icon

Best answer by Taylor Tarpley 5 December 2023, 03:27

View original

1 reply

Userlevel 7
Badge +60

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 

Reply