Skip to main content

@inContext directive added to the Customer Account API

As of API version 2025-04, we've added the @inContext directive in the Customer Account API. The @inContext directive accepts an argument: language.

  • If the requested language is active for the given country, as configured within the shop's Language settings, then the query will return translated values.
  • If an unsupported language or country is requested using @inContext, then the response will fall back to the default language.

The following operation shows an example usage of this directive:

mutation customerAddressUpdate @inContext(language: FR){
customerAddressUpdate(address: {phoneNumber: "invalid123"}, addressId: "gid://shopify/CustomerAddress/123456" ) {
userErrors {
code
field
message
}
}
}

Response:

{
"data": {
"customerAddressUpdate": {
"userErrors": [
{
"code": "PHONE_NUMBER_NOT_VALID",
"field": null,
"message": "Le numéro de téléphone n'est pas valide."
}
]
}
},
"extensions": {
"context": {
"country": "CA",
"language": "FR"
},
"cost": {
"requestedQueryCost": 10,
"actualQueryCost": 10
}
}
}
Was this section helpful?