Queries and mutations for managing Product Tailoring in the platform.
Queries
Query Product Tailoring
| Arguments | |
|---|---|
whereString | |
sortArray of String | |
limitInt | |
offsetInt | |
Get Product Tailoring
| Arguments | |
|---|---|
idString | Queries with specified ID |
keyString | Queries with specified key |
productIdString | Queries with specified Product ID |
productKeyString | Queries with specified Product key |
storeKey | The mutation is only performed if the resource is part of the store. Can be used with store-specific OAuth permissions. |
Mutations
Create Product Tailoring
| Arguments | |
|---|---|
storeKey | The mutation is only performed if the resource is part of the store. Can be used with store-specific OAuth permissions. |
draft | |
Update Product Tailoring
| Arguments | |
|---|---|
storeKey | The mutation is only performed if the resource is part of the store. Can be used with store-specific OAuth permissions. |
productIdString | Queries with specified Product ID |
productKeyString | Queries with specified Product key |
idString | Queries with specified ID |
keyString | Queries with specified key |
actionsArray of ProductTailoringUpdateAction | |
versionLong | |
Delete Product Tailoring
| Arguments | |
|---|---|
storeKey | The mutation is only performed if the resource is part of the store. Can be used with store-specific OAuth permissions. |
productIdString | Queries with specified Product ID |
productKeyString | Queries with specified Product key |
idString | Queries with specified ID |
keyString | Queries with specified key |
versionLong | |
Output types
ProductTailoring
keyString | User-defined unique identifier of the ProductTailoring. |
productRef | Reference to the Product the ProductTailoring belongs to. |
product | Reference to the Product the ProductTailoring belongs to. |
storeRef | The Store to which the ProductTailoring belongs. |
store | The Store to which the ProductTailoring belongs. |
current | Current data of the ProductTailoring returned in the Product Projection response when the ProductTailoring is published. |
staged | Staged data of the ProductTailoring. This data is not returned in the Product Projection response by default. |
publishedBoolean | Whether the tailored information contained in the current ProductTailoringData is provided when retrieving the ProductProjection in Store.
For information not part of the ProductTailoringData, the original information contained in the ProductData is provided.
If false, only the original information contained in the ProductData is provided. |
hasStagedChangesBoolean | Whether the staged data is different from the current data. |
idString | Unique identifier of the ProductTailoring. |
versionLong | Current version of the ProductTailoring. |
createdAt | Date and time (UTC) the ProductTailoring was initially created. |
lastModifiedAt | Date and time (UTC) the ProductTailoring was last updated. |
createdBy | IDs and references that created the ProductTailoring. |
lastModifiedBy | IDs and references that last modified the ProductTailoring. |
ProductTailoringData
Contains all the tailored information of a Product.
nameString | Tailored name of the Product. |
nameAllLocalesArray of LocalizedString | Tailored name of the Product. |
descriptionString | Tailored description of the Product. |
descriptionAllLocalesArray of LocalizedString | Tailored description of the Product. |
slugString | User-defined identifier used in a deep-link URL for the ProductTailoring.
Matches the pattern [a-zA-Z0-9_-]{2,256}. |
slugAllLocalesArray of LocalizedString | User-defined identifier used in a deep-link URL for the ProductTailoring.
Matches the pattern [a-zA-Z0-9_-]{2,256}. |
metaTitleString | Tailored title of the Product that is used by search engines. |
metaTitleAllLocalesArray of LocalizedString | Tailored title of the Product that is used by search engines. |
metaDescriptionString | Tailored description of the Product that is used by search engines. |
metaDescriptionAllLocalesArray of LocalizedString | Tailored description of the Product that is used by search engines. |
metaKeywordsString | Tailored keywords related to the Product that are used by search engines. |
metaKeywordsAllLocalesArray of LocalizedString | Tailored keywords related to the Product that are used by search engines. |
variantsArray of ProductVariantTailoring | Tailored Variants of the Product. |
attributesRawArray of RawProductAttribute | Attributes of the tailored Product.
If available, these Attributes are selectively merged into the attributes of the corresponding Product. If the Product contains an Attribute with the same name, then its value is overwritten. Otherwise, the Attribute and its value are added to the Product. |
ProductVariantTailoring
idInt | |
imagesArray of Image | Images of the tailored Product Variant.
If present, these images will override the images of the corresponding ProductVariant or Variant in total. |
assetsArray of Asset | Media assets of the tailored Product Variant.
If present, these assets will override the assets of the corresponding ProductVariant or Variant in total. |
attributesRawArray of RawProductAttribute | Attributes of the tailored Product Variant.
If present, these Attributes are selectively merged into the
attributes of the corresponding ProductVariant or Variant:
|
RawProductAttribute
attributeDefinition | |
nameString | |
valueJson | |
attributesRawArray of RawProductAttribute | BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta |
referencedResource | |
referencedResourceSetArray of ReferenceExpandable |
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
ProductTailoringQueryResult
offsetInt | |
countInt | |
totalLong | |
existsBoolean | |
resultsArray of ProductTailoring |
Input types
ProductTailoringDraft
Contains the information to be tailored for a Product.
product | ResourceIdentifier of the Product the ProductTailoring belongs to. |
nameArray of LocalizedStringItemInputType | Tailored name of the Product. |
keyString | User-defined unique identifier of the ProductTailoring. |
descriptionArray of LocalizedStringItemInputType | Tailored description of the Product. |
slugArray of LocalizedStringItemInputType | User-defined identifier used in a deep-link URL for the ProductTailoring.
Matches the pattern [a-zA-Z0-9_-]{2,256}. |
metaTitleArray of LocalizedStringItemInputType | Tailored title of the Product that is used by search engines. |
metaDescriptionArray of LocalizedStringItemInputType | Tailored description of the Product that is used by search engines. |
metaKeywordsArray of LocalizedStringItemInputType | Tailored keywords related to the Product that are used by search engines. |
publishBoolean | Whether to publish the ProductTailoring immediately.
Otherwise, the tailored product information is just staged. |
variantsArray of ProductVariantTailoringInput | Tailored Variants of the Product. Default:[] |
attributesArray of ProductAttributeInput | Attributes of the tailored Product.
If provided, these Attributes are selectively merged into the Default: attributes of the corresponding Product. If the Product contains an Attribute with the same name, then its value is overwritten. Otherwise, the Attribute and its value are added to the Product.[] |
ProductVariantTailoringInput
idInt | |
skuString | |
attributesArray of ProductAttributeInput | Default: [] |
imagesArray of ImageInput | |
assetsArray of AssetDraftInput |
ProductAttributeInput
An input object used to define a ProductAttribute.
The value should be passed in a form of escaped JSON.
value:- FieldType
String:"\"This is a string\"" - FieldType
DateTimeType:"\"2018-10-12T14:00:00.000Z\"" - FieldType
Number:"4" - FieldType
Setwith an elementType ofString:"[\"This is a string\", \"This is another string\"]" - FieldType
Reference:"{\"id\": \"b911b62d-353a-4388-93ee-8d488d9af962\", \"typeId\": \"product\"}"
nameString | |
valueString | The value should be passed in a form of escaped JSON. Examples for
value:
|
ImageInput
urlString | |
labelString | |
dimensions |
DimensionsInput
widthInt | |
heightInt |
AssetDraftInput
keyString | |
nameArray of LocalizedStringItemInputType | |
descriptionArray of LocalizedStringItemInputType | |
custom | |
sourcesArray of AssetSourceInput | |
tagsArray of String | |
type |
AssetSourceInput
uriString | |
keyString | |
dimensions | |
contentTypeString |
AssetDimensionsInput
widthInt | |
heightInt |
ProductTailoringUpdateAction
moveImageToPosition | |
addVariant | |
removeVariant | |
publish | |
unpublish | |
setProductAttribute | |
addAsset | |
addExternalImage | |
changeAssetName | |
changeAssetOrder | |
removeAsset | |
removeImage | |
setAssetCustomField | |
setAssetCustomType | |
setAssetDescription | |
setAssetKey | |
setAssetSources | |
setAssetTags | |
setImages | |
setAttribute | |
setAttributeInAllVariants | |
setDescription | |
setImageLabel | |
setKey | |
setMetaAttributes | |
setMetaDescription | |
setMetaKeywords | |
setMetaTitle | |
setName | |
setSlug |
Update actions
Move Image To Position
variantIdInt | The id of the tailored ProductVariant or Variant to update. |
skuString | The sku of the tailored ProductVariant or Variant to update. |
imageUrlString | The URL of the image to update. |
positionInt | Position in images where the image should be moved. Must be between 0 and the total number of images minus 1. |
stagedBoolean | Whether only the staged Default: images is updated. If false, both the current and staged images are updated.true |
Add Variant
idInt | |
skuString | |
attributesArray of ProductAttributeInput | Default: [] |
imagesArray of ImageInput | |
assetsArray of AssetDraftInput | |
stagedBoolean | Default: true |
ProductAttributeInput
An input object used to define a ProductAttribute.
The value should be passed in a form of escaped JSON.
value:- FieldType
String:"\"This is a string\"" - FieldType
DateTimeType:"\"2018-10-12T14:00:00.000Z\"" - FieldType
Number:"4" - FieldType
Setwith an elementType ofString:"[\"This is a string\", \"This is another string\"]" - FieldType
Reference:"{\"id\": \"b911b62d-353a-4388-93ee-8d488d9af962\", \"typeId\": \"product\"}"
nameString | |
valueString | The value should be passed in a form of escaped JSON. Examples for
value:
|
ImageInput
urlString | |
labelString | |
dimensions |
DimensionsInput
widthInt | |
heightInt |
AssetDraftInput
keyString | |
nameArray of LocalizedStringItemInputType | |
descriptionArray of LocalizedStringItemInputType | |
custom | |
sourcesArray of AssetSourceInput | |
tagsArray of String | |
type |
AssetSourceInput
uriString | |
keyString | |
dimensions | |
contentTypeString |
AssetDimensionsInput
widthInt | |
heightInt |
Remove Variant
idInt | |
skuString | |
stagedBoolean | Default: true |
Publish
dummyString |
Unpublish
dummyString |
Set Product Attribute
nameString | |
valueString | |
stagedBoolean | Default: true |
Add Asset
variantIdInt | The id of the tailored ProductVariant or Variant to update. |
skuString | The sku of the tailored ProductVariant or Variant to update. |
stagedBoolean | Whether only the staged Default: assets are updated. If false, both the current and staged assets are updated.true |
positionInt | Position in assets where the Asset should be put. When specified, the value must be between 0 and the total number of Assets minus 1. |
asset | Value to append. |
AssetDraftInput
keyString | |
nameArray of LocalizedStringItemInputType | |
descriptionArray of LocalizedStringItemInputType | |
custom | |
sourcesArray of AssetSourceInput | |
tagsArray of String | |
type |
AssetSourceInput
uriString | |
keyString | |
dimensions | |
contentTypeString |
AssetDimensionsInput
widthInt | |
heightInt |
Add External Image
variantId or sku is required to reference a ProductVariant or Variant that exists. Produces the ProductTailoringImageAdded Message.variantIdInt | The id of the tailored ProductVariant or Variant to update. |
skuString | The sku of the tailored ProductVariant or Variant to update. |
image | Value to add to images. |
stagedBoolean | Whether only the staged Default: images is updated. If false, both the current and staged images are updated.true |
ImageInput
urlString | |
labelString | |
dimensions |
DimensionsInput
widthInt | |
heightInt |
Change Asset Name
variantId or sku is required to reference a ProductVariant that exists.
The Asset to update must be specified using either assetId or assetKey.variantIdInt | The id of the tailored ProductVariant to update. |
skuString | The sku of the tailored ProductVariant to update. |
stagedBoolean | Whether only the staged Asset is updated. If Default: false, both the current and staged Asset is updated.true |
nameArray of LocalizedStringItemInputType | New value to set. Must not be empty. |
assetKeyString | The key of the Asset to update. |
assetIdString | The id of the Asset to update. |
Change Asset Order
variantIdInt | The id of the tailored ProductVariant to update. |
skuString | The sku of the tailored ProductVariant to update. |
stagedBoolean | Whether only the staged Default: assets is updated. If false, both the current and staged assets are updated.true |
assetOrderArray of String | All existing Asset ids of the ProductVariantTailoring in the desired new order. |
Remove Asset
variantId or sku is required to reference a ProductVariant or Variant that exists.
The Asset to remove must be specified using either assetId or assetKey.variantIdInt | The id of the tailored ProductVariant or Variant to update. |
skuString | The sku of the tailored ProductVariant or Variant to update. |
stagedBoolean | Whether only the staged Asset is removed. If Default: false, both the current and staged Asset is removed.true |
assetKeyString | The key of the Asset to remove. |
assetIdString | The id of the Asset to remove. |
Remove Image
variantIdInt | The id of the tailored ProductVariant or Variant to update. |
skuString | The sku of the tailored ProductVariant or Variant to update. |
imageUrlString | The URL of the image to remove. |
stagedBoolean | Whether only the staged image is removed. If Default: false, both the current and staged image is removed.true |
Set Asset Custom Field
variantId or sku is required to reference a ProductVariant that exists.
The Asset to update must be specified using either assetId or assetKey.variantIdInt | The id of the tailored ProductVariant to update. |
skuString | The sku of the tailored ProductVariant to update. |
stagedBoolean | Whether only the staged Asset is updated. If Default: false, both the current and staged Asset is updated.true |
valueString | If value is absent or null, this field will be removed if it exists.
Removing a field that does not exist returns an InvalidOperation error.
If value is provided, it is set for the field defined by name. |
nameString | Name of the Custom Field. |
assetKeyString | The key of the Asset to update. |
assetIdString | The id of the Asset to update. |
Set Asset Custom Type
variantIdInt | |
skuString | |
stagedBoolean | Default: true |
typeIdString | |
typeKeyString | |
type | |
fieldsArray of CustomFieldInput | |
assetKeyString | |
assetIdString |
Set Asset Description
variantId or sku is required to reference a ProductVariant that exists.
The Asset to update must be specified using either assetId or assetKey.variantIdInt | The id of the tailored ProductVariant to update. |
skuString | The sku of the tailored ProductVariant to update. |
stagedBoolean | Whether only the staged Asset is updated. If Default: false, both the current and staged Asset is updated.true |
descriptionArray of LocalizedStringItemInputType | Value to set. If omitted, any existing value is removed. |
assetKeyString | The key of the Asset to update. |
assetIdString | The id of the Asset to update. |
Set Asset Key
variantIdInt | The id of the tailored ProductVariant to update. |
skuString | The sku of the tailored ProductVariant to update. |
stagedBoolean | Whether only the staged Asset is updated. If Default: false, both the current and staged Asset is updated.true |
assetKeyString | Value to set. If omitted, any existing value is removed. |
assetIdString | The id of the Asset to update. |
Set Asset Sources
variantId or sku is required to reference a ProductVariant that exists.
The Asset to update must be specified using either assetId or assetKey.variantIdInt | The id of the tailored ProductVariant to update. |
skuString | The sku of the tailored ProductVariant to update. |
stagedBoolean | Whether only the staged Asset is updated. If Default: false, both the current and staged Asset is updated.true |
sourcesArray of AssetSourceInput | Value to set. Default:[] |
assetKeyString | The key of the Asset to update. |
assetIdString | The id of the Asset to update. |
AssetSourceInput
uriString | |
keyString | |
dimensions | |
contentTypeString |
AssetDimensionsInput
widthInt | |
heightInt |
Set Images
variantIdInt | |
skuString | |
imagesArray of ImageInput | |
stagedBoolean | Default: true |
ImageInput
urlString | |
labelString | |
dimensions |
DimensionsInput
widthInt | |
heightInt |
Set Attribute
variantId or sku is required.variantIdInt | The id of the ProductVariant or Variant to update.
Required if sku is absent. |
skuString | The sku of the ProductVariant or Variant to update.
Required if variantId is absent. |
nameString | The name of the Attribute to set. |
valueString | Value to set for the Attribute. If omitted, any existing value is removed. The AttributeType determines the format of the Attribute
value to be provided:
Tailoring of Nested Type Attributes is not supported. |
stagedBoolean | Whether only the staged Attribute is set. If Default: false, both current and staged Attribute is set.true |
Set Attribute In All Variants
SameForAll.nameString | The name of the Attribute to set. |
valueString | Value to set for the Attributes. If omitted, any existing value is removed. The AttributeType determines the format of the Attribute
value to be provided:
Tailoring of Nested Type Attributes is not supported. |
stagedBoolean | Whether only the staged Attributes are set. If Default: false, both the current and staged Attributes are set.true |
Set Description
descriptionArray of LocalizedStringItemInputType | Value to set. If omitted, any existing value is removed. |
stagedBoolean | Whether only the staged Default: description is updated. If false, both the current and staged description are updated.true |
Set Image Label
variantIdInt | The id of the tailored ProductVariant or Variant to update. |
skuString | The sku of the tailored ProductVariant or Variant to update. |
imageUrlString | The URL of the image to set the label. |
labelString | Value to set. If omitted, any existing value is removed. |
stagedBoolean | Whether only the staged image is updated. If Default: false, both the current and staged image is updated.true |
Set Key
keyString | Value to set. Must be unique. If omitted, any existing value is removed. |
Set Meta Attributes
Updates all meta attributes at the same time.
metaDescriptionArray of LocalizedStringItemInputType | Value to set. If omitted, any existing value is removed. |
metaKeywordsArray of LocalizedStringItemInputType | Value to set. If omitted, any existing value is removed. |
metaTitleArray of LocalizedStringItemInputType | Value to set. If omitted, any existing value is removed. |
stagedBoolean | Whether only the staged attributes are updated. If Default: false, both the current and staged attributes are updated.true |
Set Meta Description
metaDescriptionArray of LocalizedStringItemInputType | Value to set. If omitted, any existing value is removed. |
stagedBoolean | Whether only the staged Default: metaDescription is updated. If false, both the current and staged metaDescription are updated.true |
Set Meta Keywords
metaKeywordsArray of LocalizedStringItemInputType | Value to set. If omitted, any existing value is removed. |
stagedBoolean | Whether only the staged Default: metaKeywords is updated. If false, both the current and staged metaKeywords are updated.true |
Set Meta Title
metaTitleArray of LocalizedStringItemInputType | Value to set. If omitted, any existing value is removed. |
stagedBoolean | Whether only the staged Default: metaTitle is updated. If false, both the current and staged metaTitle are updated.true |
Set Name
nameArray of LocalizedStringItemInputType | Value to set. If omitted, any existing value is removed. |
stagedBoolean | Whether only the staged Default: name is updated. If false, both the current and staged name are updated.true |
Set Slug
slugArray of LocalizedStringItemInputType | Value to set. If omitted, any existing value is removed. |
stagedBoolean | Whether only the staged Default: slug is updated. If false, both the current and staged slug are updated.true |