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:
- GraphQL
- cURL
mutation UpdateProductAttribute($input: UpdateProductAttributeInput!) {
updateProductAttribute(input: $input) {
customFields
key
productCount
valuesTruncated
variantCount
values {
imageUrl
parentAttributeKey
parentValue
value
variantCount
}
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "mutation UpdateProductAttribute($input: UpdateProductAttributeInput!) {\n updateProductAttribute(input: $input) {\n customFields\n key\n productCount\n valuesTruncated\n variantCount\n values {\n imageUrl\n parentAttributeKey\n parentValue\n value\n variantCount\n }\n }\n}",
"variables": {
"input": {
"attributeKey": "string",
"customFields": {}
}
}
}
EOF
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.