26 June 2025
Product catalogGraphQL
You can now configure and use Product Attributes for Products. This feature is currently available in public beta. You can manage Attributes that are common to all variants in one central location at the Product level, instead of using the
sameforall
constraint. This helps reduce the size of API response payloads, thereby improving data storage efficiency and enhancing performance.With this release, we have updated the following Attribute-related terminologies to improve clarity:
- Product Attributes: to refer to Attributes defined at the Product level.
- Variant Attributes: to refer to Attributes defined at the Variant level. They were previously known as "Product Attributes."
Product Attributes are supported across the following resources and features:
- Product Types, Products, Product Projections, Product Search
- Product Tailoring, Product Discounts
- Carts, Orders, Quotes, Shopping Lists
- Product Draft Import, Product Type Import, and Order Import in the Import API
Changes:
- [API] Added the
level
field to AttributeDefinition and AttributeDefinitionDraft. - [API] Added the
attributes
field to ProductData and ProductDraft, and ProductProjection. - [API] Added the Set Product Attribute update action to the Product API.
- [API] Added the Set Product Attribute update action to the Product Tailoring API.
- [API] Added the
attributes
field to ProductTailoringData, ProductTailoringDraft, and ProductTailoringInStoreDraft. - [API] Added the
attributes
field to Product Tailoring Created Message. - [API] Added the
attributes
field to ProductImport, ProductDraftImport. - [API] Added the
level
field to the AttributeDefinition in ProductTypeImport. - [GraphQL API] Added the
attributesRaw
field to theProductData
, theProductProjection
, and theProductTailoringCreated
type. - [GraphQL API] Added the
attributes
field to theProductDraft
type. - [GraphQL API] Added the
setProductAttribute
field to theProductUpdateAction
type. - [GraphQL API] Added the
SetProductAttribute
, theSetProductLevelAttribute
, and theProductLevelAttributeInput
types to the GraphQL schema.
The following changes were introduced in terms of GraphQL SDL:
extend type ProductData {
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
attributesRaw: [RawProductAttrType!]!
}
extend input ProductDraft {
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
attributes: [ProductAttributeInput!] = []
}
extend input ProductUpdateAction {
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
setProductAttribute: SetProductAttribute
}
extend type ProductProjection {
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
attributesRaw: [RawProductAttrType!]!
}
input SetProductAttribute{
name: String
value: String
staged: Boolean = true
}
input SetProductLevelAttribute {
name: String!
value: String!
}
extend type ProductTailoringCreated {
attributesRaw: [RawProductAttribute!]!
}
"""
An input object used to define a ProductAttribute.
You should pass the value in the form of an escaped JSON.
Examples for `value`:
* FieldType `String`: `"\"This is a string\""`
* FieldType `DateTimeType`: `"\"2018-10-12T14:00:00.000Z\""`
* FieldType `Number`: `"4"`
* FieldType `Set` with an elementType of `String`: `"[\"This is a string\", \"This is another string\"]"`
* FieldType `Reference`: `"{\"id\": \"b911b62d-353a-4388-93ee-8d488d9af962\", \"typeId\": \"product\"}"`
"""
input ProductLevelAttributeInput {
name: String!
"""
You should pass the value in the form of an escaped JSON.
Examples for `value`:
* FieldType `String`: `"\"This is a string\""`
* FieldType `DateTimeType`: `"\"2018-10-12T14:00:00.000Z\""`
* FieldType `Number`: `"4"`
* FieldType `Set` with an elementType of `String`: `"[\"This is a string\", \"This is another string\"]"`
* FieldType `Reference`: `"{\"id\": \"b911b62d-353a-4388-93ee-8d488d9af962\", \"typeId\": \"product\"}"`
"""
value: String!
}