Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Hi guys,
I have a script for a custom payment instructions (bank account transfer). These instructions are visible only if the payment is selected.
I'm now trying to figure out how to set the script to two languages as the store is in 2 languages?
There is the original code:
<script>
{% if checkout.transactions[0].gateway == 'Bank Deposit' %}
Shopify.Checkout.OrderStatus.addContentBox('<h2>Instructions for Bank Account transfer:</h2>',
'<p>X</p>')
{% endif %}
</script>
The code works well. But sadly it shows up on both language sites.
Any ideas how to do it?
Thanks!
Hi @MarekRipa,
In Shopify Theme's code editing, there is a "Locales" folder that allows formatting languages through variables, so you can access it to customize and then insert those variables into the liquid file.
As for your case, you only transmit text, so multiple languages are impossible unless your script can handle multiple languages.
Please let me know if you need any further help.
If our suggestions are useful, please let us know by giving it a like, marking it as a solution, or donating here ☕.
B2B Solution & Custom Pricing | Product Labels by BSS
Need help from our expert? Kindly share your request with us via community@bsscommerce.com
Hi,
thanks for your help but can you please be more detailed about the localize?
I'm using the script in the Additional Scripts option in Settings -> Checkout.
Is there any option to solve this only with the little edit to my script? I saw some other threads that are using this code but when I tried to implement it to my code, It didn't work.
{% if request.locale.iso_code contains 'en' %}
<script> english script </script>
{% elsif request.locale.iso_code contains 'de' %}
<script> german script </script>
{% elsif request.locale.iso_code contains 'fr' %}
<script> french script </script>
{% endif %}
Thanks!
Hi @MarekRipa.,
For each line highlighted in red, it will be checked what language the website is currently using.
So for each script, the function is the same. But with the text, you will have to re-translate according to each country.
Based on your code, I only can explain to you like that. In case you want to have more detailed information, you can kindly share access to your site with me.
If our suggestions are useful, please let us know by giving it a like, marking it as a solution, or donating here ☕.
B2B Solution & Custom Pricing | Product Labels by BSS
Need help from our expert? Kindly share your request with us via community@bsscommerce.com
Yes, I was thinking the same but when I tried this code it didn't work. Can you please check if the code is OK?
<script>
{% if request.locale.iso_code contains 'en' %}
<script>
{% if checkout.transactions[0].gateway == 'Bank Deposit' %}
Shopify.Checkout.OrderStatus.addContentBox('<h2>Pay Now</h2>',
'<p>EN INSTRUCTIONS</p>')
{% endif %}
</script>
{% elsif request.locale.iso_code contains 'cs' %}
<script>
{% if checkout.transactions[0].gateway == 'Bank Deposit' %}
Shopify.Checkout.OrderStatus.addContentBox('<h2>Pay Now</h2>',
'<p>CS INSTRUCTIONS</p>')
{% endif %}
</script>
{% endif %}
</script>
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025