Storefront Api Cart Mutations don't respect language code sent in @inContext

When performing mutations on cart, the returning cart is not respecting the language code sent inside the @inContext.

For example, when creating a cart while sending @inContext with both country and language, the response correctly returns the country but ignores the language code. This seems to happen to all mutations inside the cart, this also happens when buyerIdentity is set to the expected country.

The only way to get the cart with the correct translations is using the cart query, however, this would require us to make 2 requests 1 mutation and 1 query, whenever the cart changes.

2 Likes

Hey @Tiago_Lima :waving_hand: - I did some testing to confirm behaviour, and it does appear that the language code is accepted when I run this mutation for example:

mutation CreateCartWithContext @inContext(country: CA, language: EN) {
  cartCreate(
    input: {
      lines: [
        {
          quantity: 1
          merchandiseId: "gid://shopify/ProductVariant/47123590742038"
        }
      ],
      buyerIdentity: {
        countryCode: CA
        email: "example@example.com"
      }
    }
  ) {
    cart {
      id
      checkoutUrl
      lines(first: 10) {
        edges {
          node {
            id
            quantity
            merchandise {
              ... on ProductVariant {
                id
                title
              }
            }
          }
        }
      }
      buyerIdentity {
        countryCode
      }
    }
  }
}

One thing I did encounter though is that if the desired language isn’t enabled on the country’s market, the language argument won’t be respected. This can be set in the admin at this link: https://admin.shopify.com/store/your-shop/settings/languages

To access the market assignment you’d just want to click the “…” dropdown like this:

Hope this helps - let me know if you’re encountering any further issues, happy to keep looking into this.

Thank you for your response.

I have the following query, removed some private input data and cut some characters to be within limits, but the mutation is still there. In the mutation I set the @inContext(country: $country, language: $language) with values PT and PT_PT.

The following queries/mutation are all to the same cart in the same session.

{
  "operationName": "CreateCart",
  "variables": {
    "input": {
      "attributes": [
        ...
      ],
      "buyerIdentity": {
        "countryCode": "PT"
      }
    },
    "collectionsCount": 250,
    "imagesCount": 250,
    "mediaCount": 250,
    "imageTransformInput": {
      "preferredContentType": "WEBP"
    },
    "deliveryGroupsCount": 50,
    "linesCount": 250,
    "country": "PT",
    "language": "PT_PT",
    "metafieldsIdentifiers": [
      ...
    ],
    "referencesCount": 50
  },
  "query": "mutation CreateCart($input: CartInput!, $collectionsCount: Int!, $imagesCount: Int!, $mediaCount: Int!, $imageTransformInput: ImageTransformInput, $deliveryGroupsCount: Int!, $linesCount: Int!, $country: CountryCode, $language: LanguageCode, $metafieldsIdentifiers: [HasMetafieldsIdentifier!]!, $referencesCount: Int!) @inContext(country: $country, language: $language) { cartCreate(input: $input) { userErrors { field message } cart { __typename ...BaseCart } } }  fragment CompleteProductOption on ProductOption { name optionValues { id name swatch { color image { alt id mediaContentType previewImage { url(transform: $imageTransformInput) altText } } } } }  fragment MediaItem on Media { __typename id alt mediaContentType previewImage { url(transform: $imageTransformInput) } presentation { id } ... on Video { id alt mediaContentType sources { format url mimeType } previewImage { url(transform: $imageTransformInput) } } ... on Model3d { id alt mediaContentType sources { filesize format mimeType url } previewImage { url(transform: $imageTransformInput) } } ... on MediaImage { id alt image { url(transform: $imageTransformInput) } mediaContentType previewImage { url(transform: $imageTransformInput) } } ... on ExternalVideo { id alt host mediaContentType originUrl embedUrl previewImage { url(transform: $imageTransformInput) } } }  fragment SimpleCollection on Collection { id }  fragment MediaReference on Media { __typename ... on MediaImage { id alt mediaContentType previewImage { url(transform: $imageTransformInput) width height } image { url(transform: $imageTransformInput) width height } } ... on Video { id alt mediaContentType sources { format height width mimeType url } previewImage { url(transform: $imageTransformInput) width height } } }  fragment PageReference on Page { body bodySummary onlineStoreUrl title }  fragment CollectionReference on Collection { id }  fragment ProductReference on Product { id }  fragment GenericFileReference on GenericFile { id url mimeType previewImage { url(transform: $imageTransformInput) } }  fragment BaseMetaobjectReference on Metaobject { id handle fields { key type value } type updatedAt }  fragment MetaObjectFieldLimitedReferences on MetaobjectField { reference { __typename ...MediaReference ...PageReference ...CollectionReference ...ProductReference ...GenericFileReference ...BaseMetaobjectReference } references(first: $referencesCount) { nodes { __typename ...MediaReference ...PageReference ...CollectionReference ...ProductReference ...GenericFileReference ...BaseMetaobjectReference } } }  fragment MetaobjectLimitedReference on Metaobject { id handle fields { __typename key type value ...MetaObjectFieldLimitedReferences } type updatedAt }  fragment MetaobjectFieldMetaobjectReference on Metaobject { __typename ...BaseMetaobjectReference fields { reference { __typename ...MediaReference ...PageReference ...CollectionReference ...ProductReference ...GenericFileReference ... on Metaobject { __typename ...MetaobjectLimitedReference } } references(first: $referencesCount) { nodes { __typename ...MediaReference ...PageReference ...CollectionReference ...ProductReference ...GenericFileReference ...BaseMetaobjectReference ... on Metaobject { __typename ...MetaobjectLimitedReference } } } } }  fragment MetafieldsDetailsWithNonNestedMetaObjects on HasMetafields { metafields(identifiers: $metafieldsIdentifiers) { namespace type key value reference { __typename ...MediaReference ...PageReference ...CollectionReference ...ProductReference ...GenericFileReference ...MetaobjectFieldMetaobjectReference } references(first: $referencesCount) { nodes { __typename ...MediaReference ...PageReference ...CollectionReference ...ProductReference ...GenericFileReference ...MetaobjectFieldMetaobjectReference } } } }  fragment SimpleProductWithSimplifiedMetaFields on Product { __typename id title vendor onlineStoreUrl availableForSale updatedAt options { __typename ...CompleteProductOption } images(first: $imagesCount) { nodes { url(transform: $imageTransformInput) altText } } media(first: $mediaCount) { nodes { __typename ...MediaItem } } collections(first: $collectionsCount) { nodes { __typename ...SimpleCollection } } priceRange { maxVariantPrice { amount currencyCode } minVariantPrice { amount currencyCode } } compareAtPriceRange { maxVariantPrice { amount currencyCode } minVariantPrice { amount currencyCode } } featuredImage { url(transform: $imageTransformInput) } ...MetafieldsDetailsWithNonNestedMetaObjects }  fragment ProductVariantWithProductSimplifiedMetaFields on ProductVariant { id title quantityAvailable availableForSale currentlyNotInStock quantityAvailable sku barcode product { __typename ...SimpleProductWithSimplifiedMetaFields } selectedOptions { value name } price { amount currencyCode } compareAtPrice { amount currencyCode } image { url(transform: $imageTransformInput) } }  fragment BaseCart on Cart { id attributes { key value } checkoutUrl buyerIdentity { countryCode email phone customer { id email } } cost { checkoutChargeAmount { amount currencyCode } subtotalAmount { amount currencyCode } subtotalAmountEstimated totalAmount { amount currencyCode } totalAmountEstimated } createdAt discountAllocations { __typename discountedAmount { amount currencyCode } ... on CartAutomaticDiscountAllocation { title } ... on CartCodeDiscountAllocation { code } ... on CartCustomDiscountAllocation { title } targetType } discountCodes { applicable code } appliedGiftCards { id amountUsed { amount currencyCode } balance { amount currencyCode } presentmentAmountUsed { amount currencyCode } lastCharacters } note totalQuantity updatedAt deliveryGroups(first: $deliveryGroupsCount) { nodes { id deliveryAddress { address1 address2 city company countryCodeV2 firstName formatted lastName formattedArea name phone province provinceCode zip } deliveryOptions { code deliveryMethodType description estimatedCost { amount currencyCode } handle title } selectedDeliveryOption { code description description estimatedCost { amount currencyCode } handle title } } } lines(first: $linesCount) { nodes { id cost { amountPerQuantity { amount currencyCode } compareAtAmountPerQuantity { amount currencyCode } subtotalAmount { amount currencyCode } totalAmount { amount currencyCode } } discountAllocations { __typename discountedAmount { amount currencyCode } ... on CartAutomaticDiscountAllocation { title } ... on CartCodeDiscountAllocation { code } ... on CartCustomDiscountAllocation { title } } merchandise { __typename ...ProductVariantWithProductSimplifiedMetaFields } quantity } } }"
}

The response to the previous mutation return the following payload, in the extensions, it return the correct country but the wrong language, also the buyer identity is set to the expected country.

{
  "data": {
    "cartCreate": {
      "userErrors": [],
      "cart": {
        "__typename": "Cart",
        "id": "...",
        "attributes": [
          ...
        ],
        "checkoutUrl": "...",
        "buyerIdentity": {
          "countryCode": "PT",
          "email": null,
          "phone": null,
          "customer": null
        },
        "cost": {
         ...
        },
        "createdAt": "...",
        "discountAllocations": [],
        "discountCodes": [],
        "appliedGiftCards": [],
        "note": "",
        "totalQuantity": 0,
        "updatedAt": "...",
        "deliveryGroups": {
          "nodes": []
        },
        "lines": {
          "nodes": []
        }
      }
    }
  },
  "extensions": {
    "context": {
      "country": "PT",
      "language": "EN"
    }
  }
}

If then I add line items with the same withContext.

{
  "operationName": "AddCartLineItems",
  "variables": {
    "cartID": "...",
    "lineItems": [
      {
        "quantity": 1,
        "merchandiseId": "gid://shopify/ProductVariant/53458909561207"
      }
    ],
    "collectionsCount": 250,
    "imagesCount": 250,
    "mediaCount": 250,
    "imageTransformInput": {
      "preferredContentType": "WEBP"
    },
    "deliveryGroupsCount": 50,
    "linesCount": 250,
    "country": "PT",
    "language": "PT_PT",
    "metafieldsIdentifiers": [
      ...
    ],
    "referencesCount": 50
  },
  "query": "mutation AddCartLineItems($cartID: ID!, $lineItems: [CartLineInput!]!, $collectionsCount: Int!, $imagesCount: Int!, $mediaCount: Int!, $imageTransformInput: ImageTransformInput, $deliveryGroupsCount: Int!, $linesCount: Int!, $country: CountryCode, $language: LanguageCode, $metafieldsIdentifiers: [HasMetafieldsIdentifier!]!, $referencesCount: Int!) @inContext(country: $country, language: $language) { cartLinesAdd(cartId: $cartID, lines: $lineItems) { userErrors { field message } cart { __typename ...BaseCart } } }  fragment CompleteProductOption on ProductOption { name optionValues { id name swatch { color image { alt id mediaContentType previewImage { url(transform: $imageTransformInput) altText } } } } }  fragment MediaItem on Media { __typename id alt mediaContentType previewImage { url(transform: $imageTransformInput) } presentation { id } ... on Video { id alt mediaContentType sources { format url mimeType } previewImage { url(transform: $imageTransformInput) } } ... on Model3d { id alt mediaContentType sources { filesize format mimeType url } previewImage { url(transform: $imageTransformInput) } } ... on MediaImage { id alt image { url(transform: $imageTransformInput) } mediaContentType previewImage { url(transform: $imageTransformInput) } } ... on ExternalVideo { id alt host mediaContentType originUrl embedUrl previewImage { url(transform: $imageTransformInput) } } }  fragment SimpleCollection on Collection { id }  fragment MediaReference on Media { __typename ... on MediaImage { id alt mediaContentType previewImage { url(transform: $imageTransformInput) width height } image { url(transform: $imageTransformInput) width height } } ... on Video { id alt mediaContentType sources { format height width mimeType url } previewImage { url(transform: $imageTransformInput) width height } } }  fragment PageReference on Page { body bodySummary onlineStoreUrl title }  fragment CollectionReference on Collection { id }  fragment ProductReference on Product { id }  fragment GenericFileReference on GenericFile { id url mimeType previewImage { url(transform: $imageTransformInput) } }  fragment BaseMetaobjectReference on Metaobject { id handle fields { key type value } type updatedAt }  fragment MetaObjectFieldLimitedReferences on MetaobjectField { reference { __typename ...MediaReference ...PageReference ...CollectionReference ...ProductReference ...GenericFileReference ...BaseMetaobjectReference } references(first: $referencesCount) { nodes { __typename ...MediaReference ...PageReference ...CollectionReference ...ProductReference ...GenericFileReference ...BaseMetaobjectReference } } }  fragment MetaobjectLimitedReference on Metaobject { id handle fields { __typename key type value ...MetaObjectFieldLimitedReferences } type updatedAt }  fragment MetaobjectFieldMetaobjectReference on Metaobject { __typename ...BaseMetaobjectReference fields { reference { __typename ...MediaReference ...PageReference ...CollectionReference ...ProductReference ...GenericFileReference ... on Metaobject { __typename ...MetaobjectLimitedReference } } references(first: $referencesCount) { nodes { __typename ...MediaReference ...PageReference ...CollectionReference ...ProductReference ...GenericFileReference ...BaseMetaobjectReference ... on Metaobject { __typename ...MetaobjectLimitedReference } } } } }  fragment MetafieldsDetailsWithNonNestedMetaObjects on HasMetafields { metafields(identifiers: $metafieldsIdentifiers) { namespace type key value reference { __typename ...MediaReference ...PageReference ...CollectionReference ...ProductReference ...GenericFileReference ...MetaobjectFieldMetaobjectReference } references(first: $referencesCount) { nodes { __typename ...MediaReference ...PageReference ...CollectionReference ...ProductReference ...GenericFileReference ...MetaobjectFieldMetaobjectReference } } } }  fragment SimpleProductWithSimplifiedMetaFields on Product { __typename id title vendor onlineStoreUrl availableForSale updatedAt options { __typename ...CompleteProductOption } images(first: $imagesCount) { nodes { url(transform: $imageTransformInput) altText } } media(first: $mediaCount) { nodes { __typename ...MediaItem } } collections(first: $collectionsCount) { nodes { __typename ...SimpleCollection } } priceRange { maxVariantPrice { amount currencyCode } minVariantPrice { amount currencyCode } } compareAtPriceRange { maxVariantPrice { amount currencyCode } minVariantPrice { amount currencyCode } } featuredImage { url(transform: $imageTransformInput) } ...MetafieldsDetailsWithNonNestedMetaObjects }  fragment ProductVariantWithProductSimplifiedMetaFields on ProductVariant { id title quantityAvailable availableForSale currentlyNotInStock quantityAvailable sku barcode product { __typename ...SimpleProductWithSimplifiedMetaFields } selectedOptions { value name } price { amount currencyCode } compareAtPrice { amount currencyCode } image { url(transform: $imageTransformInput) } }  fragment BaseCart on Cart { id attributes { key value } checkoutUrl buyerIdentity { countryCode email phone customer { id email } } cost { checkoutChargeAmount { amount currencyCode } subtotalAmount { amount currencyCode } subtotalAmountEstimated totalAmount { amount currencyCode } totalAmountEstimated } createdAt discountAllocations { __typename discountedAmount { amount currencyCode } ... on CartAutomaticDiscountAllocation { title } ... on CartCodeDiscountAllocation { code } ... on CartCustomDiscountAllocation { title } targetType } discountCodes { applicable code } appliedGiftCards { id amountUsed { amount currencyCode } balance { amount currencyCode } presentmentAmountUsed { amount currencyCode } lastCharacters } note totalQuantity updatedAt deliveryGroups(first: $deliveryGroupsCount) { nodes { id deliveryAddress { address1 address2 city company countryCodeV2 firstName formatted lastName formattedArea name phone province provinceCode zip } deliveryOptions { code deliveryMethodType description estimatedCost { amount currencyCode } handle title } selectedDeliveryOption { code description description estimatedCost { amount currencyCode } handle title } } } lines(first: $linesCount) { nodes { id cost { amountPerQuantity { amount currencyCode } compareAtAmountPerQuantity { amount currencyCode } subtotalAmount { amount currencyCode } totalAmount { amount currencyCode } } discountAllocations { __typename discountedAmount { amount currencyCode } ... on CartAutomaticDiscountAllocation { title } ... on CartCodeDiscountAllocation { code } ... on CartCustomDiscountAllocation { title } } merchandise { __typename ...ProductVariantWithProductSimplifiedMetaFields } quantity } } }"
}

it keeps ignoring the language code with the following response.

{
  "data": {
    "cartLinesAdd": {
      "userErrors": [],
      "cart": {
        "__typename": "Cart",
        "id": "...",
        "attributes": [
          ...
        ],
        "checkoutUrl": "...",
        "buyerIdentity": {
          "countryCode": "PT",
          "email": null,
          "phone": null,
          "customer": null
        },
        "cost": {
          ...
        },
        "createdAt": "...",
        "discountAllocations": [],
        "discountCodes": [],
        "appliedGiftCards": [],
        "note": "",
        "totalQuantity": 1,
        "updatedAt": "...",
        "deliveryGroups": {
          "nodes": []
        },
        "lines": {
          "nodes": [
            {
              "id": "...",
              "cost": {
                ...
              },
              "discountAllocations": [],
              "merchandise": {
                "__typename": "ProductVariant",
                "id": "gid://shopify/ProductVariant/53458909561207",
                "title": "3-4 Years",
                "quantityAvailable": 1046,
                "availableForSale": true,
                "currentlyNotInStock": false,
                "sku": "31047484006019",
                "barcode": "5607389865579",
                "product": {
                  "__typename": "Product",
                  "id": "gid://shopify/Product/14618974191991",
                  "title": "Cardigan in Cotton for Girls, Dark Blue",
                  "vendor": "ZY",
                  "onlineStoreUrl": "...",
                  "availableForSale": true,
                  "updatedAt": "2025-05-12T23:01:35Z",
                  "options": [
                    ...
                  ],
                  "images": {
                    "nodes": [
                      ...
                    ]
                  },
                  "media": {
                    "nodes": [
                      ...
                    ]
                  },
                  "collections": {
                    "nodes": [
                      ...
                    ]
                  },
                  "priceRange": {
                    "maxVariantPrice": {
                      "amount": "10.39",
                      "currencyCode": "EUR"
                    },
                    "minVariantPrice": {
                      "amount": "10.39",
                      "currencyCode": "EUR"
                    }
                  },
                  "compareAtPriceRange": {
                    "maxVariantPrice": {
                      "amount": "12.99",
                      "currencyCode": "EUR"
                    },
                    "minVariantPrice": {
                      "amount": "12.99",
                      "currencyCode": "EUR"
                    }
                  },
                  "featuredImage": {
                    "url": "..."
                  },
                  "metafields": [
                    null
                  ]
                },
                "selectedOptions": [
                  {
                    "value": "3-4 Years",
                    "name": "Size"
                  }
                ],
                "price": {
                 ...
                },
                "compareAtPrice": {
                  ...
                },
                "image": {
                  "url": "..."
                }
              },
              "quantity": 1
            }
          ]
        }
      }
    }
  },
  "extensions": {
    "context": {
      "country": "PT",
      "language": "EN"
    }
  }
}

But If I perform the query:

{
  "operationName": "GetCart",
  "variables": {
    "cartID": "...",
    "collectionsCount": 250,
    "imagesCount": 250,
    "mediaCount": 250,
    "imageTransformInput": {
      "preferredContentType": "WEBP"
    },
    "deliveryGroupsCount": 50,
    "linesCount": 250,
    "country": "PT",
    "language": "PT_PT",
    "metafieldsIdentifiers": [
      ...
    ],
    "referencesCount": 50
  },
  "query": "query GetCart($cartID: ID!, $collectionsCount: Int!, $imagesCount: Int!, $mediaCount: Int!, $imageTransformInput: ImageTransformInput, $deliveryGroupsCount: Int!, $linesCount: Int!, $country: CountryCode, $language: LanguageCode, $metafieldsIdentifiers: [HasMetafieldsIdentifier!]!, $referencesCount: Int!) @inContext(country: $country, language: $language) { cart(id: $cartID) { __typename ...BaseCart } }  fragment CompleteProductOption on ProductOption { name optionValues { id name swatch { color image { alt id mediaContentType previewImage { url(transform: $imageTransformInput) altText } } } } }  fragment MediaItem on Media { __typename id alt mediaContentType previewImage { url(transform: $imageTransformInput) } presentation { id } ... on Video { id alt mediaContentType sources { format url mimeType } previewImage { url(transform: $imageTransformInput) } } ... on Model3d { id alt mediaContentType sources { filesize format mimeType url } previewImage { url(transform: $imageTransformInput) } } ... on MediaImage { id alt image { url(transform: $imageTransformInput) } mediaContentType previewImage { url(transform: $imageTransformInput) } } ... on ExternalVideo { id alt host mediaContentType originUrl embedUrl previewImage { url(transform: $imageTransformInput) } } }  fragment SimpleCollection on Collection { id }  fragment MediaReference on Media { __typename ... on MediaImage { id alt mediaContentType previewImage { url(transform: $imageTransformInput) width height } image { url(transform: $imageTransformInput) width height } } ... on Video { id alt mediaContentType sources { format height width mimeType url } previewImage { url(transform: $imageTransformInput) width height } } }  fragment PageReference on Page { body bodySummary onlineStoreUrl title }  fragment CollectionReference on Collection { id }  fragment ProductReference on Product { id }  fragment GenericFileReference on GenericFile { id url mimeType previewImage { url(transform: $imageTransformInput) } }  fragment BaseMetaobjectReference on Metaobject { id handle fields { key type value } type updatedAt }  fragment MetaObjectFieldLimitedReferences on MetaobjectField { reference { __typename ...MediaReference ...PageReference ...CollectionReference ...ProductReference ...GenericFileReference ...BaseMetaobjectReference } references(first: $referencesCount) { nodes { __typename ...MediaReference ...PageReference ...CollectionReference ...ProductReference ...GenericFileReference ...BaseMetaobjectReference } } }  fragment MetaobjectLimitedReference on Metaobject { id handle fields { __typename key type value ...MetaObjectFieldLimitedReferences } type updatedAt }  fragment MetaobjectFieldMetaobjectReference on Metaobject { __typename ...BaseMetaobjectReference fields { reference { __typename ...MediaReference ...PageReference ...CollectionReference ...ProductReference ...GenericFileReference ... on Metaobject { __typename ...MetaobjectLimitedReference } } references(first: $referencesCount) { nodes { __typename ...MediaReference ...PageReference ...CollectionReference ...ProductReference ...GenericFileReference ...BaseMetaobjectReference ... on Metaobject { __typename ...MetaobjectLimitedReference } } } } }  fragment MetafieldsDetailsWithNonNestedMetaObjects on HasMetafields { metafields(identifiers: $metafieldsIdentifiers) { namespace type key value reference { __typename ...MediaReference ...PageReference ...CollectionReference ...ProductReference ...GenericFileReference ...MetaobjectFieldMetaobjectReference } references(first: $referencesCount) { nodes { __typename ...MediaReference ...PageReference ...CollectionReference ...ProductReference ...GenericFileReference ...MetaobjectFieldMetaobjectReference } } } }  fragment SimpleProductWithSimplifiedMetaFields on Product { __typename id title vendor onlineStoreUrl availableForSale updatedAt options { __typename ...CompleteProductOption } images(first: $imagesCount) { nodes { url(transform: $imageTransformInput) altText } } media(first: $mediaCount) { nodes { __typename ...MediaItem } } collections(first: $collectionsCount) { nodes { __typename ...SimpleCollection } } priceRange { maxVariantPrice { amount currencyCode } minVariantPrice { amount currencyCode } } compareAtPriceRange { maxVariantPrice { amount currencyCode } minVariantPrice { amount currencyCode } } featuredImage { url(transform: $imageTransformInput) } ...MetafieldsDetailsWithNonNestedMetaObjects }  fragment ProductVariantWithProductSimplifiedMetaFields on ProductVariant { id title quantityAvailable availableForSale currentlyNotInStock quantityAvailable sku barcode product { __typename ...SimpleProductWithSimplifiedMetaFields } selectedOptions { value name } price { amount currencyCode } compareAtPrice { amount currencyCode } image { url(transform: $imageTransformInput) } }  fragment BaseCart on Cart { id attributes { key value } checkoutUrl buyerIdentity { countryCode email phone customer { id email } } cost { checkoutChargeAmount { amount currencyCode } subtotalAmount { amount currencyCode } subtotalAmountEstimated totalAmount { amount currencyCode } totalAmountEstimated } createdAt discountAllocations { __typename discountedAmount { amount currencyCode } ... on CartAutomaticDiscountAllocation { title } ... on CartCodeDiscountAllocation { code } ... on CartCustomDiscountAllocation { title } targetType } discountCodes { applicable code } appliedGiftCards { id amountUsed { amount currencyCode } balance { amount currencyCode } presentmentAmountUsed { amount currencyCode } lastCharacters } note totalQuantity updatedAt deliveryGroups(first: $deliveryGroupsCount) { nodes { id deliveryAddress { address1 address2 city company countryCodeV2 firstName formatted lastName formattedArea name phone province provinceCode zip } deliveryOptions { code deliveryMethodType description estimatedCost { amount currencyCode } handle title } selectedDeliveryOption { code description description estimatedCost { amount currencyCode } handle title } } } lines(first: $linesCount) { nodes { id cost { amountPerQuantity { amount currencyCode } compareAtAmountPerQuantity { amount currencyCode } subtotalAmount { amount currencyCode } totalAmount { amount currencyCode } } discountAllocations { __typename discountedAmount { amount currencyCode } ... on CartAutomaticDiscountAllocation { title } ... on CartCodeDiscountAllocation { code } ... on CartCustomDiscountAllocation { title } } merchandise { __typename ...ProductVariantWithProductSimplifiedMetaFields } quantity } } }"
}

it finally stops ignoring the language code:

{
  "data": {
    "cart": {
      "__typename": "Cart",
      "id": "...",
      "attributes": [
        ...
      ],
      "checkoutUrl": "...",
      "buyerIdentity": {
        "countryCode": "PT",
        "email": null,
        "phone": null,
        "customer": null
      },
      "cost": {
        "checkoutChargeAmount": {
          ...
        },
        "subtotalAmount": {
          ...
        },
        "subtotalAmountEstimated": true,
        "totalAmount": {
          "amount": "10.39",
          "currencyCode": "EUR"
        },
        "totalAmountEstimated": true
      },
      "createdAt": "...",
      "discountAllocations": [],
      "discountCodes": [],
      "appliedGiftCards": [],
      "note": "",
      "totalQuantity": 1,
      "updatedAt": "...",
      "deliveryGroups": {
        "nodes": []
      },
      "lines": {
        "nodes": [
          {
            "id": "...",
            "cost": {
              "amountPerQuantity": {
                "amount": "10.39",
                "currencyCode": "EUR"
              },
              "compareAtAmountPerQuantity": {
                "amount": "12.99",
                "currencyCode": "EUR"
              },
              "subtotalAmount": {
                "amount": "10.39",
                "currencyCode": "EUR"
              },
              "totalAmount": {
                "amount": "10.39",
                "currencyCode": "EUR"
              }
            },
            "discountAllocations": [],
            "merchandise": {
              "__typename": "ProductVariant",
              "id": "gid://shopify/ProductVariant/53458909561207",
              "title": "3-4 Years",
              "quantityAvailable": 1046,
              "availableForSale": true,
              "currentlyNotInStock": false,
              "sku": "31047484006019",
              "barcode": "5607389865579",
              "product": {
                "__typename": "Product",
                "id": "gid://shopify/Product/14618974191991",
                "title": "Casaco de Malha em AlgodĂŁo para Menina, Azul Escuro",
                "vendor": "ZY",
                "onlineStoreUrl": "...",
                "availableForSale": true,
                "updatedAt": "2025-05-12T23:01:35Z",
                "options": [
                  ...
                ],
                "images": {
                  "nodes": [
                    ...
                  ]
                },
                "media": {
                  "nodes": [
                    ...
                  ]
                },
                "collections": {
                  "nodes": [
                    ...
                  ]
                },
                "priceRange": {
                  ...
                },
                "compareAtPriceRange": {
                  ...
                },
                "featuredImage": {
                  "url": "..."
                },
                "metafields": [
                  null
                ]
              },
              "selectedOptions": [
                {
                  "value": "3-4 Years",
                  "name": "Size"
                }
              ],
              "price": {
                ...
              },
              "compareAtPrice": {
               ...
              },
              "image": {
                "url": "..."
              }
            },
            "quantity": 1
          }
        ]
      }
    }
  },
  "extensions": {
    "context": {
      "country": "PT",
      "language": "PT_PT"
    }
  }
}

I can always replicate this behavior, the market PT has english as default language but also as spanish, frech and portuguese from portugal which matches PT_PT.

@Alan_G
Hi Alan, I need these translations for a customized customer portal. Is there any way to have the delivery methods in the requested language?
Thanks
Magali

1 Like

I have noticed that same seems to happen to the products inside the orders, @Alan_G.
When fetching the clients orders, the parameters passed inside the @inContext are also ignored when retrieving the list of products.

Hey @Tiago_Lima - thanks for those detailed examples! It is odd that the mutation is returning language: "EN" while queries correctly return language: "PT_PT" for sure.

You’re right that having to make a separate query after mutations isn’t ideal though, but I am glad that you have a temporary workaround at least.

If you are able to share an x-request-id for API responses (from the response headers) where the outputs are showing incorrectly, could you share those here? Once I have those, I can take a look at our logs and do an internal investigation. This does seem like unexpected behaviour though.

@MCP_Webdesign - for delivery methods/shipping rate names, you should generally be able to translate shipping rate names using Translate and Adapt: Re: Translating "Custom delivery description (optional)". - Shopify Community

Out of curiosity, are you setting up the customer portal using the Customer Account UI Extension set up: Customer account UI extensions

Just want to make sure I’m understanding your flow correctly. Hope to speak soon!

Hey @Alan_G thank you for the reply.

Here is a request ID of the mutation that return the incorrect language:
19cea9a6-d56a-40b7-85f3-97bb797996d0-1748944208

1 Like

Hey @Tiago_Lima :waving_hand: thanks for sending that log reference over - just want to confirm after looking at the logs here, it looks like the country was set to PT, but the language itself was set to EN in the variable input. Just want to make sure that was correct.

If so, just let me know and I’ll look into this more deeply internally. Thanks again!

Hey @Alan_G.

I don’t think that was correct, either way here is another request ID along with the request payload and response payload:
eb607fb9-17cd-4017-ad44-cb02dfbefc02-1748965474

NOTE: Censored some info, and removed some data to make the content shorter

Request Payload:
{
  "operationName": "UpdateCartLineItems",
  "variables": {
    "cartID": "---",
    "lineItems": [
      {
        "id": "---",
        "quantity": 2,
        "merchandiseId": "gid://shopify/ProductVariant/50321687380295"
      }
    ],
    "collectionsCount": 250,
    "imagesCount": 250,
    "mediaCount": 250,
    "imageTransformInput": {
      "preferredContentType": "WEBP"
    },
    "deliveryGroupsCount": 50,
    "linesCount": 250,
    "country": "PT",
    "language": "PT_PT",
    "metafieldsIdentifiers": [---],
    "referencesCount": 50
  },
  "query": "mutation UpdateCartLineItems($cartID: ID!, $lineItems: [CartLineUpdateInput!]!, $collectionsCount: Int!, $imagesCount: Int!, $mediaCount: Int!, $imageTransformInput: ImageTransformInput, $deliveryGroupsCount: Int!, $linesCount: Int!, $country: CountryCode, $language: LanguageCode, $metafieldsIdentifiers: [HasMetafieldsIdentifier!]!, $referencesCount: Int!) @inContext(country: $country, language: $language) { cartLinesUpdate(cartId: $cartID, lines: $lineItems) { userErrors { field message } cart { __typename ...BaseCart } } }  fragment CompleteProductOption on ProductOption { name optionValues { id name swatch { color image { alt id mediaContentType previewImage { url(transform: $imageTransformInput) altText } } } } }  fragment MediaItem on Media { __typename id alt mediaContentType previewImage { url(transform: $imageTransformInput) } presentation { id } ... on Video { id alt mediaContentType sources { format url mimeType } previewImage { url(transform: $imageTransformInput) } } ... on Model3d { id alt mediaContentType sources { filesize format mimeType url } previewImage { url(transform: $imageTransformInput) } } ... on MediaImage { id alt image { url(transform: $imageTransformInput) } mediaContentType previewImage { url(transform: $imageTransformInput) } } ... on ExternalVideo { id alt host mediaContentType originUrl embedUrl previewImage { url(transform: $imageTransformInput) } } }  fragment SimpleCollection on Collection { id }  fragment MediaReference on Media { __typename ... on MediaImage { id alt mediaContentType previewImage { url(transform: $imageTransformInput) width height } image { url(transform: $imageTransformInput) width height } } ... on Video { id alt mediaContentType sources { format height width mimeType url } previewImage { url(transform: $imageTransformInput) width height } } }  fragment PageReference on Page { body bodySummary onlineStoreUrl title }  fragment CollectionReference on Collection { id }  fragment ProductReference on Product { id }  fragment GenericFileReference on GenericFile { id url mimeType previewImage { url(transform: $imageTransformInput) } }  fragment BaseMetaobjectReference on Metaobject { id handle fields { key type value } type updatedAt }  fragment MetaObjectFieldLimitedReferences on MetaobjectField { reference { __typename ...MediaReference ...PageReference ...CollectionReference ...ProductReference ...GenericFileReference ...BaseMetaobjectReference } references(first: $referencesCount) { nodes { __typename ...MediaReference ...PageReference ...CollectionReference ...ProductReference ...GenericFileReference ...BaseMetaobjectReference } } }  fragment MetaobjectLimitedReference on Metaobject { id handle fields { __typename key type value ...MetaObjectFieldLimitedReferences } type updatedAt }  fragment MetaobjectFieldMetaobjectReference on Metaobject { __typename ...BaseMetaobjectReference fields { reference { __typename ...MediaReference ...PageReference ...CollectionReference ...ProductReference ...GenericFileReference ... on Metaobject { __typename ...MetaobjectLimitedReference } } references(first: $referencesCount) { nodes { __typename ...MediaReference ...PageReference ...CollectionReference ...ProductReference ...GenericFileReference ...BaseMetaobjectReference ... on Metaobject { __typename ...MetaobjectLimitedReference } } } } }  fragment MetafieldsDetailsWithNonNestedMetaObjects on HasMetafields { metafields(identifiers: $metafieldsIdentifiers) { namespace type key value reference { __typename ...MediaReference ...PageReference ...CollectionReference ...ProductReference ...GenericFileReference ...MetaobjectFieldMetaobjectReference } references(first: $referencesCount) { nodes { __typename ...MediaReference ...PageReference ...CollectionReference ...ProductReference ...GenericFileReference ...MetaobjectFieldMetaobjectReference } } } }  fragment SimpleProductWithSimplifiedMetaFields on Product { __typename id title vendor onlineStoreUrl availableForSale updatedAt options { __typename ...CompleteProductOption } images(first: $imagesCount) { nodes { url(transform: $imageTransformInput) altText } } media(first: $mediaCount) { nodes { __typename ...MediaItem } } collections(first: $collectionsCount) { nodes { __typename ...SimpleCollection } } priceRange { maxVariantPrice { amount currencyCode } minVariantPrice { amount currencyCode } } compareAtPriceRange { maxVariantPrice { amount currencyCode } minVariantPrice { amount currencyCode } } featuredImage { url(transform: $imageTransformInput) } ...MetafieldsDetailsWithNonNestedMetaObjects }  fragment ProductVariantWithProductSimplifiedMetaFields on ProductVariant { id title quantityAvailable availableForSale currentlyNotInStock quantityAvailable sku barcode product { __typename ...SimpleProductWithSimplifiedMetaFields } selectedOptions { value name } price { amount currencyCode } compareAtPrice { amount currencyCode } image { url(transform: $imageTransformInput) } }  fragment BaseCart on Cart { id attributes { key value } checkoutUrl buyerIdentity { countryCode email phone customer { id email } } cost { checkoutChargeAmount { amount currencyCode } subtotalAmount { amount currencyCode } subtotalAmountEstimated totalAmount { amount currencyCode } totalAmountEstimated } createdAt discountAllocations { __typename discountedAmount { amount currencyCode } ... on CartAutomaticDiscountAllocation { title } ... on CartCodeDiscountAllocation { code } ... on CartCustomDiscountAllocation { title } targetType } discountCodes { applicable code } appliedGiftCards { id amountUsed { amount currencyCode } balance { amount currencyCode } presentmentAmountUsed { amount currencyCode } lastCharacters } note totalQuantity updatedAt deliveryGroups(first: $deliveryGroupsCount) { nodes { id deliveryAddress { address1 address2 city company countryCodeV2 firstName formatted lastName formattedArea name phone province provinceCode zip } deliveryOptions { code deliveryMethodType description estimatedCost { amount currencyCode } handle title } selectedDeliveryOption { code description description estimatedCost { amount currencyCode } handle title } } } lines(first: $linesCount) { nodes { id cost { amountPerQuantity { amount currencyCode } compareAtAmountPerQuantity { amount currencyCode } subtotalAmount { amount currencyCode } totalAmount { amount currencyCode } } discountAllocations { __typename discountedAmount { amount currencyCode } ... on CartAutomaticDiscountAllocation { title } ... on CartCodeDiscountAllocation { code } ... on CartCustomDiscountAllocation { title } } merchandise { __typename ...ProductVariantWithProductSimplifiedMetaFields } quantity } } }"
}
Response Payload
{
  "data": {
    "cartLinesUpdate": {
      "userErrors": [],
      "cart": {
        "__typename": "Cart",
        "id": "---",
        "attributes": [...],
        "checkoutUrl": "---",
        "buyerIdentity": {
          "countryCode": "PT",
          "email": null,
          "phone": null,
          "customer": null
        },
        "cost": {
          "checkoutChargeAmount": {
            "amount": "35.98",
            "currencyCode": "EUR"
          },
          "subtotalAmount": {
            "amount": "35.98",
            "currencyCode": "EUR"
          },
          "subtotalAmountEstimated": true,
          "totalAmount": {
            "amount": "35.98",
            "currencyCode": "EUR"
          },
          "totalAmountEstimated": true
        },
        "createdAt": "2025-06-03T13:11:11Z",
        "discountAllocations": [],
        "discountCodes": [],
        "appliedGiftCards": [],
        "note": "",
        "totalQuantity": 2,
        "updatedAt": "2025-06-03T15:44:34Z",
        "deliveryGroups": {
          "nodes": []
        },
        "lines": {
          "nodes": [
            {
              "id": "---",
              "cost": {
                "amountPerQuantity": {
                  "amount": "17.99",
                  "currencyCode": "EUR"
                },
                "compareAtAmountPerQuantity": {
                  "amount": "0.0",
                  "currencyCode": "EUR"
                },
                "subtotalAmount": {
                  "amount": "35.98",
                  "currencyCode": "EUR"
                },
                "totalAmount": {
                  "amount": "35.98",
                  "currencyCode": "EUR"
                }
              },
              "discountAllocations": [],
              "merchandise": {
                "__typename": "ProductVariant",
                "id": "gid://shopify/ProductVariant/50321687380295",
                "title": "3-4 Years",
                "quantityAvailable": 27,
                "availableForSale": true,
                "currentlyNotInStock": false,
                "sku": "31072990026019",
                "barcode": "5609143180782",
                "product": {
                  "__typename": "Product",
                  "id": "gid://shopify/Product/9673096298823",
                  "title": "Swimsuit with Motif and Ruffles for Girls, Beige/Green",
                  "vendor": "ZY",
                  "onlineStoreUrl": "https://zippyonline.com/products/swimsuit-with-motif-and-ruffles-for-girls-beige-green",
                  "availableForSale": true,
                  "updatedAt": "2025-06-03T04:25:47Z",
                  "options": [...],
                  "images": {
                    "nodes": [
                      {
                        "url": "https://cdn.shopify.com/s/files/1/0795/2711/7127/files/31072990026-0.jpg.webp?v=1748070434",
                        "altText": null
                      },
                      {
                        "url": "https://cdn.shopify.com/s/files/1/0795/2711/7127/files/31072990026-1.jpg.webp?v=1748070435",
                        "altText": null
                      },
                      {
                        "url": "https://cdn.shopify.com/s/files/1/0795/2711/7127/files/31072990026-2.jpg.webp?v=1748070431",
                        "altText": null
                      },
                      {
                        "url": "https://cdn.shopify.com/s/files/1/0795/2711/7127/files/31072990026-3.jpg.webp?v=1748070431",
                        "altText": null
                      },
                      {
                        "url": "https://cdn.shopify.com/s/files/1/0795/2711/7127/files/31072990026-4.jpg.webp?v=1748070432",
                        "altText": null
                      },
                      {
                        "url": "https://cdn.shopify.com/s/files/1/0795/2711/7127/files/31072990026-5.jpg.webp?v=1748070431",
                        "altText": null
                      },
                      {
                        "url": "https://cdn.shopify.com/s/files/1/0795/2711/7127/files/31072990026-6.jpg.webp?v=1748070437",
                        "altText": null
                      }
                    ]
                  },
                  "media": {
                    "nodes": [...]
                  },
                  "collections": {
                    "nodes": [...]
                  },
                  "priceRange": {
                    "maxVariantPrice": {
                      "amount": "17.99",
                      "currencyCode": "EUR"
                    },
                    "minVariantPrice": {
                      "amount": "17.99",
                      "currencyCode": "EUR"
                    }
                  },
                  "compareAtPriceRange": {
                    "maxVariantPrice": {
                      "amount": "0.0",
                      "currencyCode": "EUR"
                    },
                    "minVariantPrice": {
                      "amount": "0.0",
                      "currencyCode": "EUR"
                    }
                  },
                  "featuredImage": {
                    "url": "https://cdn.shopify.com/s/files/1/0795/2711/7127/files/31072990026-0.jpg.webp?v=1748070434"
                  },
                  "metafields": [
                    null
                  ]
                },
                "selectedOptions": [
                  {
                    "value": "3-4 Years",
                    "name": "Size"
                  }
                ],
                "price": {
                  "amount": "17.99",
                  "currencyCode": "EUR"
                },
                "compareAtPrice": {
                  "amount": "0.0",
                  "currencyCode": "EUR"
                },
                "image": {
                  "url": "https://cdn.shopify.com/s/files/1/0795/2711/7127/files/31072990026-0.jpg.webp?v=1748070434"
                }
              },
              "quantity": 2
            }
          ]
        }
      }
    }
  },
  "extensions": {
    "context": {
      "country": "PT",
      "language": "EN"
    }
  }
}

Ah - thanks @Tiago_Lima , it looks like somehow the requested language is changing on our end. Still can’t confirm if this is expected or what might be happening, but this is really helpful, appreciate you sending that my way, I’ll dig into this more internally and get back in touch with you once I have an answer or if we need to do some more troubleshooting with you.

1 Like