"InputObject 'CustomerUpdateInput' doesn't accept argument 'metafields'"

I have to updated metafields in for customer in custom data but when I run this

mutation {
customerUpdate(
customerAccessToken: “ba66f112107a1ffd4be40c6671d79431”,

customer: {

, metafields: [{
namespace: “instructions”,
key: “wash”,
valueInput: {
value: “cold wash”,
valueType: “STRING”
}

}
]} ) {
userErrors {
field
message
}
customer {
metafields(first: 100) {
edges {
node {
id
namespace
key
value
}
}
}
}
}
}

I face errors

Hi Maaazahmed,

The error you’re experiencing might occur due to several reasons. Here are a couple things you might want to check:

  1. Invalid Access Token: Make sure your customerAccessToken is valid. Access tokens can expire, so you should ensure it’s up-to-date.

  2. Incorrect Syntax: Look for any syntax errors in your mutation. In your case, there is a comma , before `metafields which may be causing a syntax error.

  3. Permissions: Ensure that you have the necessary permissions to update the customer’s metafields.

  4. Valid Namespace and Key: Make sure the namespace and key you are trying to update actually exist for this customer.

  5. Proper Value Input: Ensure that the value and valueType you are trying to update are compatible. In your case, it looks correct as you’re a string value.

Here’s your corrected mutation:

mutation {
  customerUpdate(
    customerAccessToken: "ba66f112107a1ffd4be40c6671d79431", 
    customer: {
      metafields: [{
        namespace: "instructions",
        key: "wash",
        valueInput: {
          value: "cold wash",
          valueType: "STRING"
        }
      }]
    }
  ) {
    userErrors {
      field
      message
    }
    customer {
      metafields(first: 100) {
        edges {
          node {
            id
            namespace
            key
            value
          }
        }
      }
    }
  }
}

If possible can you also share the error message you’re seeing?

Hope this helps!

Thank You Laim

I have checked the access token, and it’s valid.

basically mutation is no accepting Metafields argument

When i use Shopify GraphiQL App working fine mutation customerUpdate($input: CustomerInput!) {
customerUpdate(input: $input) {
userErrors {
message
field
}
customer {
firstName
lastName
email
id
phone
metafields(first: 10) {
edges {
node {
namespace
key
value
id
}
}
}
}
}
}
but when run same code in postmen its node working and return this error

Error: CustomerInput isn’t a defined input type (on $input)"
I have checked everything and also i have set HTTP-headers