Personalized checkout and custom promotions with Shopify Scripts
Hi,
I would like to translate the discount message in a Shopify Script.
Therefore I was thinking to make use of the Input.locale string.
Does anyone have an example of how to use this?
The locale can end with the country code so I wanted to take the first characters of the string, but this gets an undefined method []:
input_locale = Input.locale[0,2]
message_discount = "Free Coffee Gift"
if input_locale == "fr"
message_discount = "Cadeau de café gratuit"
end
The message doesn't even change when I change the code by a regular equation:
message_discount = "Cadeau de café gratuit"
if Input.locale == "en"
message_discount = "Free Coffee Gift"
end
June brought summer energy to our community. Members jumped in with solutions, clicked ...
By JasonH Jun 5, 2025Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025