The `customer_locale` property. How is it set?

Solved
tamarah
New Member
3 0 0

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!

0 Likes
marcd
Excursionist
14 1 2

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:

customerinfo.png

 

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.

0 Likes
marcd
Excursionist
14 1 2

This is an accepted solution.

{% case customer_locale %}
        {% when 'en' %}
            engelse text
        {% when 'de' %}
            duitse text
        {% else %}
            nederlandse TEXT
{% endcase %}

Works 

0 Likes
SBD_
Shopify Staff
Shopify Staff
1044 141 185

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.

0 Likes