Skip to content

Catalog Attribute Options — Create / Update / Delete (GraphQL) ​

Options are the selectable values of a select, multiselect, or checkbox attribute (e.g. the Red / Green / Blue values of a "Color" attribute). They cannot be added to any other attribute type. Per-locale labels go under each option's translations. All three mutations return the option as adminAttributeOption; select its _id (the numeric option id) rather than id, since the option has no standalone detail route.

See the Attributes overview for how attributes, options, and families fit together.

Operations ​

OperationTypePurpose
createAdminAttributeOptionMutationAdd an option to a select/multiselect/checkbox attribute
updateAdminAttributeOptionMutationPartial update of an option
deleteAdminAttributeOptionMutationRemove an option

Create takes the parent attributeId: Int! inside input. Update and delete identify the option with three input fields: the option IRI in input.id (/api/admin/catalog/attributes/{attributeId}/options/{optionId}) plus attributeId: Int! and optionId: Int!.

Input — Create / Update ​

FieldTypeNotes
attributeIdInt!Parent attribute id (required on all three operations)
idStringOption IRI — required on update and delete
optionIdIntOption id — required on update and delete
adminNameStringInternal admin label (required on create)
sortOrderIntDisplay order
swatchValueStringHex color / image path / display text, depending on the parent attribute's swatch type
translationsJSONMap of locale to { label }

Errors ​

ConditionMessage
Attribute is not select/multiselect/checkboxThis attribute type does not support options.
Delete refused — option in use by productsThis option is used by N product(s) and cannot be deleted.
Unknown idAttribute option not found.

Released under the MIT License.