younifyd
Menu

updateProduct

Update an existing product — pass its current version and an array of update actions.

Use it in a workflow

  1. Add a step and choose the Commercetools connector.
  2. Pick the updateProduct action (under Update).
  3. 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.

graphql
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.

versionstringrequired
actionsarray<object>required
moveImageToPositionobject5 fields
setSearchKeywordsobject2 fields
revertStagedChangesobject1 fields
revertStagedVariantChangesobject1 fields
publishobject1 fields
setProductAttributeobject3 fields
unpublishobject1 fields
transitionStateobject2 fields
removePriceobject2 fields
addAssetobject5 fields
addExternalImageobject4 fields
addPriceobject4 fields
addToCategoryobject3 fields
addVariantobject7 fields
changeAssetNameobject6 fields
changeAssetOrderobject4 fields
changeMasterVariantobject3 fields
changeImageLabelobject5 fields
changeNameobject2 fields
changePriceobject5 fields
changeSlugobject2 fields
removeAssetobject5 fields
removeFromCategoryobject2 fields
removeImageobject4 fields
removeVariantobject3 fields
setAssetCustomFieldobject7 fields
setAssetCustomTypeobject9 fields
setAssetDescriptionobject6 fields
setAssetKeyobject5 fields
setAssetSourcesobject6 fields
setAssetTagsobject6 fields
setCategoryOrderHintobject3 fields
setDefaultVariantobject2 fields
setDiscountedPriceobject3 fields
setAttributeobject5 fields
setAttributeInAllVariantsobject3 fields
setDescriptionobject2 fields
setImageLabelobject5 fields
setKeyobject1 fields
setMetaAttributesobject4 fields
idstring

Queries with specified ID

keystring

Queries with specified key

json
{
  "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}}.

idstring
keystring
versionstring
productTypeRefobject
typeIdstring
idstring
productTypeobject
keystring
namestring
descriptionstring
idstring
versionstring
createdAtstring
lastModifiedAtstring
createdByobject8 fields
lastModifiedByobject8 fields
masterDataobject
currentobject15 fields
stagedobject15 fields
publishedboolean
hasStagedChangesboolean
skusarray<string>
createdAtstring
lastModifiedAtstring
stateRefobject
typeIdstring
idstring
stateobject
idstring
versionstring
keystring
typestring

One ofLineItemStateOrderStatePaymentStateProductStateQuoteRequestStateQuoteStateRecurringOrderStateReviewStateStagedQuoteState

rolesarray<object>
nameAllLocalesarray<object>
descriptionAllLocalesarray<object>
builtInboolean
transitionsRefarray<object>
transitionsarray<object>
initialboolean
createdAtstring
lastModifiedAtstring
createdByobject8 fields
lastModifiedByobject8 fields
priceModestring

One ofEmbeddedStandalone

taxCategoryRefobject
typeIdstring
idstring
taxCategoryobject
namestring
descriptionstring
ratesarray<object>
keystring
idstring
versionstring
createdAtstring
lastModifiedAtstring
createdByobject8 fields
lastModifiedByobject8 fields
reviewRatingStatisticsobject
averageRatingnumber
highestRatingnumber
lowestRatingnumber
countstring
ratingsDistributionstring
createdByobject
isPlatformClientboolean
clientIdstring
externalUserIdstring
anonymousIdstring
customerRefobject2 fields
userRefobject2 fields
associateRefobject2 fields
attributedToobject3 fields
lastModifiedByobject
isPlatformClientboolean
clientIdstring
externalUserIdstring
anonymousIdstring
customerRefobject2 fields
userRefobject2 fields
associateRefobject2 fields
attributedToobject3 fields

Need more? See the Commercetools guide for connection setup and behaviour shared by every action.