Attributes Mutations

CreateAttribute

Creates a new product attribute value (e.g. "Red" for a "Color" option).

Parameters:

ParameterTypeDescription
inputCreateAttributeInput!Attribute data.

Example Query:

mutation CreateAttribute($input: CreateAttributeInput!) {
  CreateAttribute(input: $input) {
    id
    label
    option { id label }
  }
}

Example Variables:

{
  "input": {
    "label": "Cotton",
    "option": {
      "id": 10002
    }
  }
}

UpdateAttribute

Updates an existing attribute value.

Parameters:

ParameterTypeDescription
idInt!ID of the attribute.
inputUpdateAttributeInput!Updated data.

Example Query:

mutation UpdateAttribute($id: ID!, $input: UpdateAttributeInput!) {
  UpdateAttribute(id: $id, input: $input) {
    id
    label
  }
}

DeleteAttribute

Deletes an attribute value.

Parameters:

ParameterTypeDescription
idInt!ID of the attribute to delete.

Example Query:

mutation DeleteAttribute($id: ID!) {
  DeleteAttribute(id: $id)
}

Input Data Types

CreateAttributeInput

FieldTypeDescription
labelString!Name of the attribute.
optionOptionInput!The Option this attribute belongs to.

UpdateAttributeInput

FieldTypeDescription
idIntID of the attribute.
labelString!Name of the attribute.
optionOptionInputOptional. Change the option.

AttributeInput

FieldTypeDescription
idIntID.
labelString!Name.
optionOptionInputOption payload.