Development discussions around Shopify APIs
To continue receiving payouts, you need to secure your account by turning on two-step authentication. If two-step authentication is not turned on your payouts will be paused. Learn more
Hi there,
The `customer_locale` property. How is it set?
I've looked at this questions on the forum: https://community.shopify.com/c/Shopify-APIs-SDKs/Checkout-Customer-Locale/td-p/448845
I also thought it was set by the locale of the store but there is no confirmation nowhere also not in the docs and this guy on the forum even had another experience with it.
So how is this property set? Is it true that it's set by the locale of the store? So that a store with only 1 locale (no translation apps) will always deliver the same value in customer locale? regardless of the location of the shipping address?
I hope you can help me with this.. All help is appreciated!
Solved! Go to the solution
This is an accepted solution.
{% case customer_locale %} {% when 'en' %} engelse text {% when 'de' %} duitse text {% else %} nederlandse TEXT {% endcase %}
Works
Hi @tamarah,
I'm in the same boot as u. So I'm going to follow this topic.
My situation:
Buy Button channel that uses html lang attribute to change the checkout url to include the local paramater.
var theLanguage = $('html').attr("lang"); console.log(theLanguage); if(theLanguage == "nl-NL"){ var localCheckout = '&locale=nl';
and then on the cart property:
"events": { afterInit: (cart) => { cart.onCheckout = () => { const checkoutUrl = cart.model.webUrl + localCheckout; // we dynamically change the checkout function. cart.checkout.open(checkoutUrl); }; },
In the backend I can see the local attribute:
I'm just not sure how I can use this Taal: Engels (Language: English) attribute in the notifications to customise these. I tried 2 orders, 1 on local=en and 1 on local=de.
The default transactional emails arrived perfectly in different languages. I'm just not sure to use the attribute to adjust the email templates.
Should be something like:
{% case customer.lang %} {% when 'fr' %} FRENCH TEXT {% when 'es' %} SPANISH TEXT {% when 'pt' %} PORTUGUESE TEXT {% else %} ENGLISH TEXT {% endcase %}
So I hope that in following this topic we both can find a solution.
This is an accepted solution.
{% case customer_locale %} {% when 'en' %} engelse text {% when 'de' %} duitse text {% else %} nederlandse TEXT {% endcase %}
Works
Hey @tamarah
From an earlier answer
In doing some testing it looks like the customer_locale field is set by the language that a shop's theme is set to - so if they're using Shopify's theme translations/languages this should be set on any orders that go through the storefront.
Scott | Developer Support @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
Hi!
We are looking for a way to display the customers language in the Shopify backend. The 'Taal: Engels' is not displayed in our Shopify backend.
Do you remember how you got this displayed?
Dankjewel!
User | RANK |
---|---|
6 | |
5 | |
5 | |
5 | |
4 |
Learn these 5 things I had to learn the hard way with starting and running my own business
By Kitana Jan 27, 2023Would you love to unleash the unbridled power of the Google Shopping Channel into your sho...
By Gabe Jan 6, 2023How can you turn a hobby into a career? That’s what Emmanuel did while working as a wa...
By Skye Dec 30, 2022