0

I have try to update the address via GraphQl but somehow not working

enter image description here

Please guide me how can I solve this error

enter image description here

1
  • I have the same issue... That doesn't work either > region: { region: "" region_code: "" region_id: 0 } ? – Any solutions?
    – Daniele
    Commented Apr 17 at 5:54

1 Answer 1

0

We Need existing Customer Address Id to update address.

Syntax

mutation: {updateCustomerAddress(id: Int!, input: CustomerAddressInput) {CustomerAddress}}

Example:

mutation {
  updateCustomerAddress(id:5, input: {
    region: {
      region_id: 12,
      region: "California"
      region_code: "CA"
    }
    country_code: US
    street: ["123 Main Street"]
    telephone: "7777777777"
    postcode: "77777"
    city: "Phoenix"
    firstname: "Bob"
    lastname: "Loblaw"
    default_shipping: true
    default_billing: false
  }) {
    id
  }
}

Update Reference Link -> https://devdocs.magento.com/guides/v2.4/graphql/mutations/update-customer-address.html#customerAddressRegionInput

region -> DATA TYPE -> String -> The state or province name

region_code -> DATA TYPE -> String -> The address region code 

region_id -> DATA TYPE -> Int -> The unique ID for a pre-defined region
10
  • "message": "A region_id is required for the specified country code",
    – Arjun
    Commented Dec 30, 2021 at 14:06
  • This is the error I am getting
    – Arjun
    Commented Dec 30, 2021 at 14:06
  • I added the SS in my Ques
    – Arjun
    Commented Dec 30, 2021 at 14:10
  • Please check my query region: { region_id: 12, region: "California" region_code: "CA" } region_id inside into region:{} data. region_id must be valid value.
    – Msquare
    Commented Jan 3, 2022 at 4:05
  • Yes i know that but I need to update address for QATAR & I don't think we have region for that. In that case what to do?
    – Arjun
    Commented Jan 3, 2022 at 4:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.