Update Customer language (locale) with Shopify Flow & Send HTTP Request

Hi,

according to some other posts, it might be possible to update customer language (aka “locale”). Issue comes from the fact when a customer is imported, the notifications are sent in English. Not possible to specify “locale”.

Someone suggested to use Shopify Flow and Send HTTP Request. I did try a few things, query is successful, but nothing is updated. I tried to use mutation customerUpdate, but not luck. Since Flow is out of scope for Shopify assistance, anybody have any hints, tips, adivices or solutions for this? :slightly_smiling_face:

If you post more detail about your Send HTTP Request that would help.

I tried tons of things, but latest:

{"query": "mutation { customerUpdate(input: {locale: \"{{customer.locale}}\",  locale: \"fr\"}) { customer { locale } }"}

We are you setting the locale twice? You are also missing the customer id.

I’m also not sure that is the right syntax for a mutation. Have you tried it in something like Postman?

In fact, I’m not even sure it’s possible. Initially, I tried the following (see below) and tried Shopify examples, but nothing works.

{
    "query": "mutation customerUpdate($input: CustomerInput!) { customerUpdate(input: $input) customer { id locale } } }",
     "variables": {
        "input": {
          "id": "gid://shopify/Customer/7025645551839",
          "locale": "fr"
        }
      }
    }

I tested in postman…this is a working example. You are missing at least one bracket (after customerUpdate).

{"query":"mutation updateLocale($input: CustomerInput!) {\n    customerUpdate(input: $input) {\n        userErrors {\n            field\n            message\n        }\n        customer {\n            id\n            locale\n        }\n    }\n}","variables":{"input":{"id":"gid://shopify/Customer/20952568692758","locale":"en"}}}

Thanks. However, nothing is getting updated. At some points, I think it’s just not possibe.

OK, I tested this in Flow and confirmed that it works. One nuance that I forgot…because Flow uses Liquid you cannot use {{ or }} anywhere or Flow will interpret it as liquid (solved by adding a space in between).

{"query":"mutation customerUpdate($input: CustomerInput!) {\n customerUpdate(input: $input) {\n userErrors {\n field\n message\n }\n  }\n }", "variables":{"input":{"id":"{{ customer.id}}","locale":"fr" } } }

And just in case, this is what the config looks like:

Hello,

thanks. Body looks great. I have proper settings, but still no luck. Locale is just not updating. The flow is as follow:

Start when: Customer tags added

Check if: tag is equal to “something”

Do this: Sent HTTP request

In App Development, appropriate Admin API access scopes are added.

Are you sure the action is getting called? Can you show a workflow run where it didn’t work?

You mean something like this:

Status: Succeeded
Action: 1 succeeded: Send HTTP request

Ok, that looks fine. Are you sure it’s not working. The way I can tell is by this little bit of text in the Admin:

The language in customer page doesn’t update. It stays to “English”

Ok, and can you share your send http request panel then?

You are using an app’s API token. That might be just blocked because you aren’t providing all of the app details you need to in this API request. Since the request for GraphQL returns 200 even with errors but you can’t see the errors in Flow, it looks successful.

I’d recommend creating an API key for the shop (Settings / App and sales channels / develop apps / create an app) and make sure that API key can read and write customers.

I did create an app with: write_customers, read_customers. I’m using Admin API access token.

I think you created a public app. I don’t think you can just use the token generated for that app in another app.

I created a “custom app” based on Shopify’s documentation (and the same way you mentionned, by going to Settings / App and sales channels / develop apps / create an app). If that’s not the way to get API token, how can it be done?

The instructions are above in this thread.