Shopify - Translate your Shopify email notifications
In this article, you'll learn how to translate your email notifications to your Shopify store.
Weglot automatically translates your website content. As emails aren't part of your website, Weglot can't translate them by default. However, Weglot allows you to manually manage email content based on the language selected when placing an order.
This feature applies to order notifications but not to gift card notifications.
Before getting started, please remember that there are various notification types, and the method can be slightly different for each.
I. The order & shipping notifications:
1. Open your text editor and paste the following liquid code.
Based on the translated languages configured on your website, you may need to adapt the code snippet by modifying the language from {% when '[language-code]' %}
.
Assuming that your website's original language is English and the destination languages translated by Weglot are Spanish and French. The overall structure of the liquid file would be as follows:
{% case attributes.lang %} {% when 'es' %} EMAIL EN ESPAÑOL AQUÍ {% when 'fr' %} EMAIL EN FRANÇAIS ICI {% else %} EMAIL IN ENGLISH HERE (ORIGINAL LANGUAGE) {% endcase %}
The above code snippet is intended as an example only. Be sure to edit it to match the languages set in your Weglot project.
Here's another example. If your website's original language is French and the destination language translated by Weglot is German only. The overall structure of the liquid file would be as follows:
{% case attributes.lang %} {% when 'de' %} EMAIL AUF DEUTSCH HIER {% else %} EMAIL EN FRANÇAIS ICI (ORIGINAL LANGUAGE) {% endcase %}
It means that when an order is placed in German, the customer should receive the content written between {% when 'de' %}
and {% else %}
code lines. However, if an order is placed in a language other than German, it will receive the content written between the {% else %}
and {% endcase %}
code lines.
2. In the Shopify administration, navigate to Settings > Notifications > Customer notifications and open the email you wish to translate.
Let's select the "Order Confirmation" email.
Click on the "Edit code" button.
3. Copy the email body
4. Open your text editor and paste the email body instead of "EMAIL IN ENGLISH HERE" (applicable if your website's original language is English).
In the example below, the website's original language is English, so the content "EMAIL IN ENGLISH HERE" has been replaced by the email body.
5. Replace "EMAIL EN ESPAÑOL AQUÍ" with the email body translated into Spanish and "EMAIL EN FRANÇAIS ICI" with the email body translated into French. Repeat this operation as many times as needed.
In the example below, the original English language has been manually translated into French: "Thank you for your order!" becomes "Merci pour votre commande !".
Make sure you only modify the sentences. You must not translate any liquid code between {% %}
or {{ }}
.
6. Once the liquid code has been updated in your text editor, simply copy and paste it into your Shopify administration > Notifications > Customer notifications in the notification you wish to translate.
The example below is the "Order confirmation" email.
7. Proceed in the exact same way for the email subject.
You can do exactly the same thing for the subject of the email: In a text editor, copy and paste the code and replace the fields with the translation of the subject, like this, for example:
{% case attributes.lang %} {% when 'es' %} Pedido {{nombre}} confirmado {% when 'fr' %} Commande {{nom}} confirmée {% else %} Order {{name}} confirmed {% endcase %}
Paste it into the " Email subject " field:
8. Click on the "Save" button in the top right-hand corner.
You're done! Your customer should receive the email in their language.
II. The customer notifications
For the customer notifications, you may add a language tag to the customer information in your Shopify admin > Customers. The lang tag should be applied based on the language chosen by visitors when registering on your website.
To enable the feature, you must add customer_tag: true
to the Weglot code snippet.
To do this, there are 3 possibilities:
- Go into your Shopify administration > Online Store > Themes > Actions > Edit Code > if you find a file named
weglot_switcher.liquid
, you can update the Weglot snippet that way:
<script src="//cdn.weglot.com/weglot.min.js"></script> <script id="has-script-tags"> Weglot.initialize({ api_key: "YOUR_API_KEY", customer_tag: true }); </script>
If you don't find this file, go to your
theme.liquid
file and search for the Weglot snippet. If you find it, adapt it as shown above. Otherwise, it might be that you are using the Weglot Shopify app.If you are using the Weglot Shopify app, please reach out to our support at support@weglot.com to ask us to add this parameter to your settings.
Once the Weglot code snippet is added to your Shopify store, you can create the customer notification mentioned above.
Please follow the same procedure as for the first part of this guide, except that you must use the following code instead:
{% assign language = customer.tags | join: '' | split: '#wg' %} {% case language[1] %} {% when 'en' %} English account confirmation {% else %} Original Customer account confirmation {% endcase %}
Please note that the customer notifications feature isn't retroactive. This means customers registering before the launch won't get a lang tag.
Any feedback on this article? Let us know!