Skip to main content

commercetools actions

The commercetools extension provides actions for retrieving product, category, and customer group data from commercetools within Workforce Flows. Use these actions to fetch individual records or search and browse content as part of your automated content processes.

The commercetools action extension can be installed from the Workforce integration marketplace.

See commercetools configuration for details of how to obtain the credentials you need to configure the commercetools action extension.

Tip

These action descriptions cover the most commonly used inputs and outputs. When designing flows, you may also notice additional input and output variables.

Shared price selection inputs
Link copied!

Several actions support the following optional price selection inputs. These can only be used in conjunction with the Price Currency parameter.

InputTypeDescription
priceCurrencystringCurrency code in ISO 4217 format (e.g. USD)
priceCountrystringCountry code in ISO 3166 format (e.g. US)
priceCustomerGroupstringID of an existing Customer Group for price selection
priceCustomerGroupAssignmentsstringComma-separated IDs of Customer Groups for price selection when using multiple groups
priceChannelstringID of an existing Channel for price selection
priceRecurrencePolicystringID of an existing RecurrencePolicy for price selection

Get product by ID
Link copied!

Retrieves full product data for a single product by its ID from Commercetools.

Inputs

InputTypeRequiredDescription
idstringYesThe unique identifier of the product
localestringNoLocale identifier (e.g. fr) that determines the localized product data returned
expandstringNoComma-separated list of related resources to expand in the response
priceCurrencystringNoSee shared price selection inputs
priceCountrystringNoSee shared price selection inputs
priceCustomerGroupstringNoSee shared price selection inputs
priceCustomerGroupAssignmentsstringNoSee shared price selection inputs
priceChannelstringNoSee shared price selection inputs
priceRecurrencePolicystringNoSee shared price selection inputs

Outputs

OutputTypeDescription
productobjectThe full product object. See product object below

Update product by ID
Link copied!

Updates a product by its ID in Commercetools using one or more update actions.

Inputs

InputTypeRequiredDescription
idstringYesThe unique identifier of the product to update
versionstringYesThe expected version of the product. If it does not match the actual version, a ConcurrentModification error is returned
actionsarrayYesAn array of update action objects to perform on the product. See update actions below

Product update actions
Link copied!

Each entry in the actions array must include the following fields:

FieldTypeRequiredDescription
actionstringYesThe name of the update action to perform. Accepted values: changeName, setDescription, setSearchKeywords, setMetaTitle, setMetaDescription, setMetaKeywords
payloadstringYesA JSON-stringified object containing the action data. The structure depends on the action type (e.g. {"name": {"en": "New product name"}} for changeName). See the Commercetools update actions documentation

Outputs

OutputTypeDescription
productobjectThe updated product object. See product object below

Get basic product by ID
Link copied!

Retrieves a simplified set of product data for a single product by its ID from Commercetools. Intended for use with commerce repositories.

Inputs

InputTypeRequiredDescription
idstringYesThe unique identifier of the product
localestringNoLocale identifier (e.g. fr) that determines the localized product data returned
expandstringNoComma-separated list of related resources to expand in the response
priceCurrencystringNoSee shared price selection inputs
priceCountrystringNoSee shared price selection inputs
priceCustomerGroupstringNoSee shared price selection inputs
priceCustomerGroupAssignmentsstringNoSee shared price selection inputs
priceChannelstringNoSee shared price selection inputs
priceRecurrencePolicystringNoSee shared price selection inputs

Outputs

OutputTypeDescription
product.idstringProduct ID
product.namestringProduct name
product.descriptionstringProduct description
product.imagesarrayList of image objects, each with a url field

Get products by search term
Link copied!

Retrieves a paginated list of products matching a search term from Commercetools. Full-text search is performed on localized product content in the specified language.

Inputs

InputTypeRequiredDescription
termstringYesThe text to search for. Full-text search is performed in the localized product content of the specified language
localestringNoLocale identifier (e.g. fr) that determines the localized product data returned
markMatchingVariantsstringNoSet to true to mark matching variants in the search result
fuzzystringNoSet to true to apply fuzzy search on the search term
fuzzyLevelstringNoOverrides the default fuzzy level. Only applicable when fuzzy is true. Accepted values: 0 (1-2 character terms), 1 (3-5 character terms), 2 (more than 5 characters)
expandstringNoComma-separated list of related resources to expand in the response
stagedstringNoWhether to search in current or staged product projections. Setting to true requires the view_products OAuth scope
localeProjectionstringNoComma-separated list of locales for locale-based projection
storeProjectionstringNoKey of an existing Store. The store's languages, countries, distribution channels, and supply channels are used for projections based on locale, price, and inventory
priceCurrencystringNoSee shared price selection inputs
priceCountrystringNoSee shared price selection inputs
priceCustomerGroupstringNoSee shared price selection inputs
priceCustomerGroupAssignmentsstringNoSee shared price selection inputs
priceChannelstringNoSee shared price selection inputs
priceRecurrencePolicystringNoSee shared price selection inputs
pagination.offsetstringNoStarting index for paginated results. Default: 0
pagination.limitstringNoMaximum number of results. Default: 20. Values above 20 are ignored
pagination.sortstringNoComma-separated list of fields to sort by

Outputs

OutputTypeDescription
totalnumberTotal number of matching products
startnumberStart index of the current page
endnumberEnd index of the current page
productsarrayList of product projection objects. See product projection object below

Get basic products by optional keyword
Link copied!

Retrieves a cursor-paginated list of products matching an optional keyword from Commercetools. Intended for use with commerce repositories.

Inputs

InputTypeRequiredDescription
keywordstringNoThe text to search for. If omitted, returns all products
beforestringNoA pagination cursor to retrieve the page of products before a given position. Use the startCursor value from a previous response
afterstringNoA pagination cursor to retrieve the page of products after a given position. Use the endCursor value from a previous response

Outputs

OutputTypeDescription
pageInfo.startCursorstringCursor for the first item in the current page
pageInfo.endCursorstringCursor for the last item in the current page
pageInfo.hasPreviousPagebooleanWhether a previous page exists
pageInfo.hasNextPagebooleanWhether a next page exists
productsarrayList of basic product objects, each with id, name, description, and images (array of objects with a url field)

Get products by category ID
Link copied!

Retrieves a paginated list of products belonging to a category from Commercetools.

Inputs

InputTypeRequiredDescription
idstringYesThe unique identifier of the category
localestringNoLocale identifier (e.g. fr) that determines the localized product data returned
markMatchingVariantsstringNoSet to true to mark matching variants in the search result
expandstringNoComma-separated list of related resources to expand in the response
stagedstringNoWhether to search in current or staged product projections. Setting to true requires the view_products OAuth scope
localeProjectionstringNoComma-separated list of locales for locale-based projection
storeProjectionstringNoKey of an existing Store used for projections based on locale, price, and inventory
priceCurrencystringNoSee shared price selection inputs
priceCountrystringNoSee shared price selection inputs
priceCustomerGroupstringNoSee shared price selection inputs
priceCustomerGroupAssignmentsstringNoSee shared price selection inputs
priceChannelstringNoSee shared price selection inputs
priceRecurrencePolicystringNoSee shared price selection inputs
pagination.offsetstringNoStarting index for paginated results. Default: 0
pagination.limitstringNoMaximum number of results. Default: 20. Values above 20 are ignored
pagination.sortstringNoComma-separated list of fields to sort by

Outputs

OutputTypeDescription
totalnumberTotal number of matching products
startnumberStart index of the current page
endnumberEnd index of the current page
productsarrayList of product projection objects. See product projection object below

Get category by ID
Link copied!

Retrieves a single category by its ID from Commercetools.

Inputs

InputTypeRequiredDescription
idstringYesThe unique identifier of the category
localestringNoLocale identifier (e.g. fr) that determines the localized category data returned
expandstringNoComma-separated list of related resources to expand in the response

Outputs

OutputTypeDescription
categoryobjectThe category object. See category object below

Update category by ID
Link copied!

Updates a category by its ID in Commercetools using one or more update actions.

Inputs

InputTypeRequiredDescription
idstringYesThe unique identifier of the category to update
versionstringYesThe expected version of the category. If it does not match the actual version, a ConcurrentModification error is returned
actionsarrayYesAn array of update action objects to perform on the category. See update actions below

Category update actions
Link copied!

Each entry in the actions array must include the following fields:

FieldTypeRequiredDescription
actionstringYesThe name of the update action to perform. Accepted values: changeName, changeSlug, setDescription, setMetaTitle, setMetaDescription, setMetaKeywords
payloadstringYesA JSON-stringified object containing the action data. The structure depends on the action type (e.g. {"name": {"en": "New category name"}} for changeName). See the Commercetools update actions documentation

Outputs

OutputTypeDescription
categoryobjectThe updated category object. See category object below

Get categories by search term
Link copied!

Retrieves a paginated list of categories matching a search term from Commercetools. Full-text search is performed on localized category content in the specified language.

Inputs

InputTypeRequiredDescription
termstringYesThe text to search for. Full-text search is performed in the localized category content of the specified language
localestringNoLocale identifier (e.g. fr) that determines the localized category data returned
expandstringNoComma-separated list of related resources to expand in the response
pagination.offsetstringNoStarting index for paginated results. Default: 0
pagination.limitstringNoMaximum number of results. Default: 20. Values above 20 are ignored
pagination.sortstringNoComma-separated list of fields to sort by

Outputs

OutputTypeDescription
totalnumberTotal number of matching categories
startnumberStart index of the current page
endnumberEnd index of the current page
categoriesarrayList of category objects. See category object below

Get customer group by ID
Link copied!

Retrieves a single customer group by its ID from Commercetools.

Inputs

InputTypeRequiredDescription
idstringYesThe unique identifier of the customer group
expandstringNoComma-separated list of related resources to expand in the response

Outputs

OutputTypeDescription
customerGroup.idstringCustomer group ID
customerGroup.versionnumberVersion
customerGroup.createdAtstringCreated date
customerGroup.lastModifiedAtstringLast modified date
customerGroup.createdByobjectCreator details (clientId, isPlatformClient, anonymousId, customer, user)
customerGroup.lastModifiedByobjectLast modifier details (clientId, isPlatformClient, anonymousId, customer, user)
customerGroup.namestringCustomer group name
customerGroup.keystringCustomer group key

Get customer groups
Link copied!

Retrieves all customer groups from Commercetools.

Inputs

InputTypeRequiredDescription
pagination.offsetstringNoStarting index for paginated results. Default: 0
pagination.limitstringNoMaximum number of results. Default: 20. Values above 20 are ignored

Outputs

OutputTypeDescription
totalnumberTotal number of customer groups
startnumberStart index of the current page
endnumberEnd index of the current page
customerGroupsarrayList of customer group objects

Product object
Link copied!

The full product object returned by Get product by ID and Update product by ID contains the following fields:

FieldTypeDescription
idstringProduct ID
versionnumberVersion
lastModifiedAtstringLast modified date
createdByobjectCreator details (clientId, isPlatformClient, anonymousId, customer, user)
lastModifiedByobjectLast modifier details (clientId, isPlatformClient, anonymousId, customer, user)
productTypeobjectProduct type reference (typeId, id)
masterData.publishedbooleanWhether the product is published
masterData.hasStagedChangesbooleanWhether there are staged (unpublished) changes
masterData.currentobjectThe current published product data. See product data fields
masterData.stagedobjectThe staged (unpublished) product data. See product data fields

Product data fields
Link copied!

Both masterData.current and masterData.staged share the following structure:

FieldTypeDescription
namestringLocalized product name
slugstringLocalized URL slug
metaTitlestringMeta title
metaDescriptionstringMeta description
masterVariantobjectThe master variant (id, images)
variantsarrayAdditional variants, each with id and images

Each variant's images array contains objects with url and dimensions (object with w and h).

Product projection object
Link copied!

The product projection objects returned by search and category listing actions contain the following fields:

FieldTypeDescription
idstringProduct ID
versionstringVersion
productTypeobjectProduct type reference (typeId, id)
namestringLocalized product name
descriptionstringLocalized product description
slugstringLocalized URL slug
metaTitlestringMeta title
metaDescriptionstringMeta description
masterVariantobjectThe master variant (id, images)
variantsarrayAdditional variants, each with id and images
hasStagedChangesbooleanWhether there are staged changes
publishedbooleanWhether the product is published
keystringProduct key
priceModestringPrice mode
createdAtstringCreated date
lastModifiedAtstringLast modified date

Each variant's images array contains objects with url and dimensions (object with w and h).

Category object
Link copied!

The category object returned by Get category by ID, Update category by ID, and Get categories by search term contains the following fields:

FieldTypeDescription
idstringCategory ID
versionnumberVersion
versionModifiedAtstringVersion modified date
lastMessageSequenceNumbernumberLast message sequence number
createdAtstringCreated date
lastModifiedAtstringLast modified date
createdByobjectCreator details (clientId, isPlatformClient, anonymousId, customer, user)
lastModifiedByobjectLast modifier details (clientId, isPlatformClient, anonymousId, customer, user)
keystringCategory key
orderHintstringOrder hint for sorting
externalIdstringExternal identifier
ancestorsarrayList of ancestor category references (typeId, id)
parentobjectParent category reference (typeId, id)
namestringLocalized category name
slugstringLocalized URL slug

Adding actions to flows

Inputs, outputs and ports

Input field variables

Developing extensions