Skip to main content

updateProductAttribute

Requires permission products:product:update.

Sets the organization's own field values on a product attribute (a key sent replaces its value, null clears it, a key left out keeps it). Requires permission to update products.

Errors: a failed call returns a GraphQL errors entry, not a field on the result, and data may be null or partial. Read the entry's extensions.code and message; every shape and code is in the Error reference.

Example:

mutation UpdateProductAttribute($input: UpdateProductAttributeInput!) {
updateProductAttribute(input: $input) {
customFields
key
productCount
valuesTruncated
variantCount
values {
imageUrl
parentAttributeKey
parentValue
value
variantCount
}
}
}

Variables:

{
"input": {
"attributeKey": "string",
"customFields": {}
}
}

Response:

{
"data": {
"updateProductAttribute": {
"customFields": {},
"key": "string",
"productCount": 0,
"valuesTruncated": true,
"variantCount": 0,
"values": [
{
"imageUrl": "string",
"parentAttributeKey": "string",
"parentValue": "string",
"value": "string",
"variantCount": 0
}
]
}
}
}
updateProductAttribute(
input: UpdateProductAttributeInput!
): ProductAttribute!

Arguments​

updateProductAttribute.input ● UpdateProductAttributeInput! non-null input​

The attribute and its field values.

Type​

ProductAttribute object​

A product attribute and its values.