Menu
updateProduct
Update an existing product — pass its current version and an array of update actions.
Use it in a workflow
- Add a step and choose the Commercetools connector.
- Pick the updateProduct action (under Update).
- Fill in the fields below, then reference the result from later steps as
{{updateproduct.response.data}}.
Query
This is the mutation the action sends by default. Edit it in the step's Query field to change which fields come back.
mutation UpdateProduct($version: Long!, $actions: [ProductUpdateAction!]!, $id: String, $key: String) {
updateProduct(version: $version, actions: $actions, id: $id, key: $key) {
id
key
version
productTypeRef {
typeId
id
}
productType {
key
name
description
id
version
createdAt
lastModifiedAt
createdBy {
isPlatformClient
clientId
externalUserId
anonymousId
customerRef
userRef
associateRef
attributedTo
}
lastModifiedBy {
isPlatformClient
clientId
externalUserId
anonymousId
customerRef
userRef
associateRef
attributedTo
}
}
masterData {
current {
nameAllLocales
descriptionAllLocales
slugAllLocales
categoryOrderHints
categoriesRef
categories
searchKeywords
metaTitleAllLocales
metaKeywordsAllLocales
metaDescriptionAllLocales
masterVariant
skus
attributesRaw
defaultVariantRef
defaultVariant
}
staged {
nameAllLocales
descriptionAllLocales
slugAllLocales
categoryOrderHints
categoriesRef
categories
searchKeywords
metaTitleAllLocales
metaKeywordsAllLocales
metaDescriptionAllLocales
masterVariant
skus
attributesRaw
defaultVariantRef
defaultVariant
}
published
hasStagedChanges
}
skus
createdAt
lastModifiedAt
stateRef {
typeId
id
}
state {
id
version
key
type
roles
nameAllLocales {
locale
value
}
descriptionAllLocales {
locale
value
}
builtIn
transitionsRef {
typeId
id
}
transitions
initial
createdAt
lastModifiedAt
createdBy {
isPlatformClient
clientId
externalUserId
anonymousId
customerRef
userRef
associateRef
attributedTo
}
lastModifiedBy {
isPlatformClient
clientId
externalUserId
anonymousId
customerRef
userRef
associateRef
attributedTo
}
}
priceMode
taxCategoryRef {
typeId
id
}
taxCategory {
name
description
rates {
name
amount
includedInPrice
country
state
id
key
subRates
}
key
id
version
createdAt
lastModifiedAt
createdBy {
isPlatformClient
clientId
externalUserId
anonymousId
customerRef
userRef
associateRef
attributedTo
}
lastModifiedBy {
isPlatformClient
clientId
externalUserId
anonymousId
customerRef
userRef
associateRef
attributedTo
}
}
reviewRatingStatistics {
averageRating
highestRating
lowestRating
count
ratingsDistribution
}
createdBy {
isPlatformClient
clientId
externalUserId
anonymousId
customerRef {
typeId
id
}
userRef {
typeId
id
}
associateRef {
typeId
id
}
attributedTo {
clientId
source
userRef
}
}
lastModifiedBy {
isPlatformClient
clientId
externalUserId
anonymousId
customerRef {
typeId
id
}
userRef {
typeId
id
}
associateRef {
typeId
id
}
attributedTo {
clientId
source
userRef
}
}
}
}
Variables
Pass these as a JSON object in the step's Variables field.
{
"version": "string",
"actions": [
{
"moveImageToPosition": {
"imageUrl": "string",
"position": "string",
"variantId": "string",
"sku": "string",
"staged": "string"
},
"setSearchKeywords": {
"searchKeywords": "string",
"staged": "string"
},
"revertStagedChanges": {
"dummy": "string"
},
"revertStagedVariantChanges": {
"variantId": "string"
},
"publish": {
"scope": "string"
},
"setProductAttribute": {
"name": "string",
"value": "string",
"staged": "string"
},
"unpublish": {
"dummy": "string"
},
"transitionState": {
"state": "string",
"force": "string"
},
"removePrice": {
"priceId": "string",
"staged": "string"
},
"addAsset": {
"asset": "string",
"variantId": "string",
"sku": "string",
"staged": "string",
"position": "string"
},
"addExternalImage": {
"image": "string",
"variantId": "string",
"sku": "string",
"staged": "string"
},
"addPrice": {
"price": "string",
"variantId": "string",
"sku": "string",
"staged": "string"
}
}
],
"id": "string",
"key": "string"
}
Response
Read the result with {{updateproduct.response.data.data.updateProduct}}. If the API returns errors, the step fails and they are at {{updateproduct.response.data.errors}}.
Need more? See the Commercetools guide for connection setup and behaviour shared by every action.
Was this page helpful?