Queries and mutations for managing Product Types in the platform.
Queries
Query Product Types
| Arguments | |
|---|---|
whereString | |
sortArray of String | |
limitInt | |
offsetInt | |
Get Product Type
| Arguments | |
|---|---|
idString | Queries with specified ID |
keyString | Queries with specified key |
Mutations
Create Product Type
Update Product Type
| Arguments | |
|---|---|
versionLong | |
actionsArray of ProductTypeUpdateAction | |
idString | Queries with specified ID |
keyString | Queries with specified key |
Delete Product Type
| Arguments | |
|---|---|
versionLong | |
idString | Queries with specified ID |
keyString | Queries with specified key |
Output types
ProductTypeDefinition
AttributeDefinitionResult
limitInt | |
offsetInt | |
totalInt | |
resultsArray of AttributeDefinition |
AttributeDefinition
type | Describes the Type of the Attribute. |
nameString | User-defined name of the Attribute that is unique within the Project. |
labelString | Human-readable label for the Attribute. |
isRequiredBoolean | Whether the Attribute must have a value on a ProductVariant. |
attributeConstraint | Specifies how Attributes are validated across all variants of a Product. Can beNone, Unique, CombinationUnique, or SameForAll |
level | Specifies whether the Attribute is defined at the Product or Variant level. Can beVariant, or Product |
inputTipString | Provides additional Attribute information to aid content managers configure Product details. |
inputHint | Provides a visual representation directive for values of this Attribute (only relevant for AttributeTextType and AttributeLocalizableTextType). Can be SingleLine, or MultiLine |
isSearchableBoolean | Whether the Attribute's values are available in the Product Search or the Product Projection Search API for use in full-text search queries, filters, and facets.
However, if an Attribute's
level is set as Product, then Product Projection Search does not support the Attribute.
To use the Attribute in search, filters, or facets, set isSearchable to true for all AttributeDefinitions with the same name across different ProductTypes.
If the isSearchable values are different, the Attribute isn't available for search, filters, or facets.The exact features that are available with this flag depend on the specific AttributeType.
The maximum size of a searchable field is restricted by the Field content size limit.
This constraint is enforced at both Product creation and Product update.
If the length of the input exceeds the maximum size, an InvalidField error is returned. |
savedToLineItemBoolean | Whether the Attribute value is copied onto the LineItem when the Product is added to a Cart.
When
false, the Attribute value is excluded from the Line Item variant. Line Items already in a Cart are not immediately affected by a change to this value. Existing Line Items are updated the next time their Product data is refreshed, such as when a Recalculate update action is performed with updateProductData set to true, or on a Cart update that triggers an API Extension. Replicating a Cart creates a new Cart that contains the current Product data; it does not update the original Cart.When savedToLineItem is false, LineItem predicates that reference this Attribute, such as those in Cart Discounts and Shipping Methods, evaluate as if the Attribute is not set. |
labelAllLocalesArray of LocalizedString | Human-readable label for the Attribute. |
inputTipAllLocalesArray of LocalizedString | Provides additional Attribute information to aid content managers configure Product details. |
AttributeDefinitionType
AttributeConstraint
None- No constraints are applied to the attribute
Unique- Attribute value should be different in each variant
CombinationUnique- A set of attributes, that have this constraint, should have different combinations in each variant
SameForAll- Attribute value should be the same in all variants
Level
Variant- The attribute can be used on the variant level
Product- The attribute can be used on the product level
ProductTypeDefinitionQueryResult
offsetInt | |
countInt | |
totalLong | |
existsBoolean | |
resultsArray of ProductTypeDefinition |
Input types
ProductTypeDraft
nameString | |
descriptionString | |
keyString | |
attributeDefinitionsArray of AttributeDefinitionDraft |
AttributeDefinitionDraft
type | Describes the Type of the Attribute. When the type is different for an AttributeDefinition using the same name in multiple ProductTypes, an AttributeDefinitionTypeConflict error is returned. |
nameString | User-defined name of the Attribute that must be unique within the ProductType. To use the same name in multiple ProductTypes, each AttributeDefinition must have the same type; otherwise, an AttributeDefinitionTypeConflict error is returned.
For enum or lenum Types and sets of these AttributeTypes, the enum values can be different for each ProductType. |
labelArray of LocalizedStringItemInputType | Human-readable label for the Attribute. |
isRequiredBoolean | Whether the Attribute is required to have a value on a ProductVariant. |
attributeConstraint | Specifies how an Attribute or a combination of Attributes should be validated across all variants of a Product.
If the Attribute is defined at Product level, then Can be attributeConstraint must be None. Otherwise, an InvalidOperation error is returned.None, Unique, CombinationUnique, or SameForAll |
level | Specifies whether the Attribute is defined at the Product or Variant level. Can beVariant, or Product |
inputTipArray of LocalizedStringItemInputType | Provides additional information about the Attribute that aids content managers when setting Product details. |
inputHint | Provides a visual representation directive for values of this Attribute (only relevant for AttributeTextType and AttributeLocalizableTextType). Can be SingleLine, or MultiLine |
isSearchableBoolean | Set as
true if you want the Attribute's values to be available in the Product Search or the Product Projection Search API and can be used in full-text search queries, filters, and facets.
If an Attribute's level is set as Product, then Product Projection Search does not support the Attribute.
To use the Attribute in search, filters, or facets, set isSearchable to true for all AttributeDefinitions with the same name across different ProductTypes.
If the isSearchable values are different, the Attribute isn't available for search, filters, or facets.Which exact features are available with this flag depends on the specific AttributeType.
The maximum size of a searchable field is restricted by the Field content size limit.
This constraint is enforced at both Product creation and Product update.
If the length of the input exceeds the maximum size, an InvalidField error is returned. |
savedToLineItemBoolean | Whether the Attribute value is copied onto the LineItem when the Product is added to a Cart.
When
false, the Attribute value is excluded from the Line Item variant. Line Items already in a Cart are not immediately affected by a change to this value. Existing Line Items are updated the next time their Product data is refreshed, such as when a Recalculate update action is performed with updateProductData set to true, or on a Cart update that triggers an API Extension. Replicating a Cart creates a new Cart that contains the current Product data; it does not update the original Cart.When Default: savedToLineItem is false, LineItem predicates that reference this Attribute, such as those in Cart Discounts and Shipping Methods, evaluate as if the Attribute is not set.true |
AttributeTypeDraft
text | |
number | |
money | |
date | |
time | |
datetime | |
boolean | |
reference | |
enum | |
lenum | |
ltext |
AttributeSetTypeDraft
elementType |
AttributeSetElementTypeDraft
text | |
number | |
money | |
date | |
time | |
datetime | |
boolean | |
reference | |
enum | |
lenum | |
ltext |
SimpleAttributeTypeDraft
dummyString |
ReferenceTypeDefinitionDraft
referenceTypeIdString |
EnumTypeDraft
valuesArray of PlainEnumValueDraft |
PlainEnumValueDraft
keyString | |
labelString |
LocalizableEnumTypeDraft
valuesArray of LocalizedEnumValueDraft |
AttributeConstraint
None- No constraints are applied to the attribute
Unique- Attribute value should be different in each variant
CombinationUnique- A set of attributes, that have this constraint, should have different combinations in each variant
SameForAll- Attribute value should be the same in all variants
Level
Variant- The attribute can be used on the variant level
Product- The attribute can be used on the product level
ProductTypeUpdateAction
setKey | |
changeName | |
changeDescription | |
removeAttributeDefinition | |
changeLabel | |
setInputTip | |
changeIsSearchable | |
setSavedToLineItem | |
changeInputHint | |
addAttributeDefinition | |
changeAttributeOrder | |
changeAttributeOrderByName | |
removeEnumValues | |
addPlainEnumValue | |
changePlainEnumValueLabel | |
changePlainEnumValueOrder | |
addLocalizedEnumValue | |
changeLocalizedEnumValueLabel | |
changeLocalizedEnumValueOrder | |
changeAttributeName | |
changeEnumKey |
Update actions
Set Key
keyString |
Change Name
nameString |
Change Description
descriptionString |
Remove Attribute Definition
nameString |
Change Label
attributeNameString | |
labelArray of LocalizedStringItemInputType |
Set Input Tip
attributeNameString | |
inputTipArray of LocalizedStringItemInputType |
Change Is Searchable
attributeNameString | |
isSearchableBoolean |
Set Saved To Line Item
attributeNameString | |
savedToLineItemBoolean |
Change Input Hint
attributeNameString | |
newValue | Can be SingleLine, or MultiLine |
Add Attribute Definition
attributeDefinition |
Change Attribute Order
attributeDefinitionsArray of AttributeDefinitionDraft |
Change Attribute Order By Name
attributeNamesArray of String |
Remove Enum Values
attributeNameString | |
keysArray of String |
Add Plain Enum Value
attributeNameString | |
value |
PlainEnumValueDraft
keyString | |
labelString |
Change Plain Enum Value Label
attributeNameString | |
newValue |
PlainEnumValueDraft
keyString | |
labelString |
Change Plain Enum Value Order
attributeNameString | |
valuesArray of PlainEnumValueDraft |
PlainEnumValueDraft
keyString | |
labelString |
Add Localized Enum Value
attributeNameString | |
value |
Change Localized Enum Value Label
attributeNameString | |
newValue |
Change Localized Enum Value Order
attributeNameString | |
valuesArray of LocalizedEnumValueDraft |
Change Attribute Name
attributeNameString | |
newAttributeNameString |
Change Enum Key
attributeNameString | |
keyString | |
newKeyString |