A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
Hi,
how can we set the language for email and sms notifications when creating orders through the Shopify Rest API?
The customer_locale seems to be read-only according to the API reference (if that is even the right parameter for it).
Best regards,
Felix
Solved! Go to the solution
This is an accepted solution.
Hi @fhelger
You are correct that the REST Order.customer_locale field is read_only.
I can add a feature request for the REST API, but for now you could also try using the customerCreate or customerUpdate mutations to set the correct locale, then creating/ completing draft orders for the customer using the GraphQL Admin API to send notifications in the desired language as a workaround.
Cheers,
JamesG | API 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
I'm having the same issue here...
I would love to here an answer on this.
@Shopify can you please have a look at it. Thanks
This is an accepted solution.
Hi @fhelger
You are correct that the REST Order.customer_locale field is read_only.
I can add a feature request for the REST API, but for now you could also try using the customerCreate or customerUpdate mutations to set the correct locale, then creating/ completing draft orders for the customer using the GraphQL Admin API to send notifications in the desired language as a workaround.
Cheers,
JamesG | API 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
this did not worked for me, I tried with customerUpdate mutation and I get a failed message saying --> Error: InputObject 'CustomerInput' doesn't accept argument 'languageCode'.
Please help if there is a solution.
Hi @ShubhamDhage 👋
The notification language is determined by the `Customer.locale` attribute, formatted as an ISO code. The following is an example customerUpdate mutation and variables:
mutation ($input: CustomerInput!) {
customerUpdate(input: $input) {
customer {
locale
}
}
}
{
"input": {
"id": "gid://shopify/Customer/5790884724854",
"locale": "fr"
}
}
The list of locales can be queried with the below:
{
availableLocales {
name
isoCode
}
}
Hope that helps!
Developer Support @ Shopify
- Was this reply helpful? Click Like to let us 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