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
Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024