Skip to content

Catalog Attribute — Update (GraphQL)

Updates an existing attribute. id is the attribute IRI (/api/admin/catalog/attributes/{id}). code is immutable — supplying a different value raises an errors[] entry. type cannot be changed while product attribute values still reference the attribute. Supplying options replaces the full option set (items with an id are updated, items without an id are inserted, and omitted ids are deleted). The mutation returns the full attribute detail.

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

The nested options and their translations are not returned on the mutation payload — re-query adminAttribute to read them back.

Validation and the regex pattern

validation names the rule a value must satisfy — numeric, email, decimal, url or regex. Choosing regex makes regex required, and the pattern is checked before it is stored.

A pattern must be delimited with /, may carry only the i, m, s and u modifiers, and must compile. That is narrower than PHP alone accepts because the same pattern is also written into the storefront's own form rules, where a # delimiter or a PCRE-only modifier would break the form for every product using the attribute. A pattern that does not qualify is refused rather than stored.

Released under the MIT License.