Using If/Else/If Else Statements in an email

Remarkety supports conditional content within email. You can show/hide content based on almost any dynamic property (field) available to use in email.

Here is a simple and easy solution for those of you who need conditional content based on customer's country.

Maybe it is not the perfect multi language solution, but it covers most cases.

You can use the {customer_country_code} tag together with {if} tags inside your email template.

See use case example of how to add a conditional text in the V2 editor:

{if {$shopper.countryCode} == "ESP"} Gracias por visitar nuestro sitio web
{elseif {$shopper.countryCode} == "FRA"} Merci de visiter notre site Web
{else} Thank you for visiting our website
{/if}

 You can see that we left the last option for English as a default :-)

 

See use case example of how to add a conditional text in the V3 editor:

1. Add an empty Row and include a Text block. Select the Row and click on "Add condition". 

2. In the condition editor, add the following to create the condition for if a shopper's country code is "ESP" then show only the text in Spanish: 

{if {$shopper.countryCode} == "ESP"}

{/if}

For example: 

3. Duplicate the row, and click on the "Edit condition" button. In the condition editor, add the following to create the condition for if a shopper's country code is "FRA" then show only the text in French:

{if {$shopper.countryCode} == "FRA"}

{/if}

For example:

4. Lastly, we need to create the ELSE condition. Duplicate the row again, and click on the "Edit condition" button. In the condition editor, add the following to create the condition for if a shopper's country code is NOT "FRA" OR "SPA" then show only the text in English:

{if {$shopper.countryCode} != "ESP" and {$shopper.countryCode} != "FRA"}

{/if}

 For example: 

 

Other examples for conditional text:

1. Displaying a message only if the customer has reward points:

{if {$shopper.totalRewards} gt 0}

2. Offer a free shipping coupon if order total value is greater than $100:

{if {$order.total} gt 100}

3. This is a combination of 2 condition to offer a higher coupon to shoppers who spent more than $500, and a lower coupon for total spent less than $500

{if {$shopper.totalSpent} gt 500}

{if {$shopper.totalSpent} lt 500}

 

To learn more about conditional texts, contact support@remarkety.com 

 

 

 

 

Have more questions? Submit a request

3 Comments

  • 0
    Avatar
    Tobias Conrad

    no country code in subject

  • 0
    Avatar
    Tobias Conrad

    the customer i tested is sure from germany(GER), but he gets ENG emails,

     

    {store_header}

    {if {customer_country_code} == "GER"}Hallo {customer_first_name},

    {else}Hello {customer_first_name},

    {/if}

    {if {customer_country_code} == "GER"}Wir würden Sie gerne einladen die {store_url text="our store"} wieder zu besuchen.

    {else}We would like to invite you to come visit {store_url text="our store"} again.{/if}

    {if {customer_country_code} == "GER"} {customer_first_name}, {store_url text="our store"} läd Sie für Ihren Einkauf in den Kundennewsletter ein.

    {else} {customer_first_name}, {store_url text="our store"} invites you for your order to the customer newsletter.{/if}

     

    {if {customer_country_code} == "GER"}Danke das Sie {store_name} wählen,{else}Thank you for choosing {store_name}, {/if}

    {contact_name}

    {contact_email}

    {store_url text={store_name}}

    {if {customer_country_code} == "GER"} Hier können Sie diese E-Mails von uns stoppen.{unsubscribe text="unsubscribe here"}

    {else}If you no longer wish to receive email communications from us, {unsubscribe text="unsubscribe here"}{/if}

  • 1
    Avatar
    Joel Presman

    Hi Tobias,

    This is a very useful example. It should work if your customer has the value "GER" in the country code field in the database.

    Please open a support ticket and provide us with the exact user name or email address and we will check it for you.

    Do you see the right values in the template when toggle to view mode in the HTML editor?

    Thanks,

    Joel

    Remarkety team

Please sign in to leave a comment.