Menu
createCartDiscount
Create a new cart discount.
Use it in a workflow
- Add a step and choose the Commercetools connector.
- Pick the createCartDiscount action (under Create).
- Fill in the fields below, then reference the result from later steps as
{{createcartdiscount.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 CreateCartDiscount($draft: CartDiscountDraft!, $storeKey: KeyReferenceInput) {
createCartDiscount(draft: $draft, storeKey: $storeKey) {
cartPredicate
stackingMode
isActive
requiresDiscountCode
key
discountGroupRef {
typeId
id
}
nameAllLocales {
locale
value
}
descriptionAllLocales {
locale
value
}
referenceRefs {
typeId
id
}
custom {
typeRef {
typeId
id
}
type {
key
nameAllLocales
descriptionAllLocales
resourceTypeIds
id
version
createdAt
lastModifiedAt
createdBy
lastModifiedBy
}
}
validFrom
validUntil
storesRef {
typeId
key
}
stores {
id
version
key
nameAllLocales {
locale
value
}
languages
countries {
code
}
productSelections {
productSelectionRef
productSelection
active
}
distributionChannelsRef {
typeId
id
}
distributionChannels {
id
version
key
roles
nameAllLocales
descriptionAllLocales
address
geoLocation
createdAt
lastModifiedAt
reviewRatingStatistics
custom
createdBy
lastModifiedBy
}
supplyChannelsRef {
typeId
id
}
supplyChannels {
id
version
key
roles
nameAllLocales
descriptionAllLocales
address
geoLocation
createdAt
lastModifiedAt
reviewRatingStatistics
custom
createdBy
lastModifiedBy
}
storefront {
checkoutUrlTemplate
orderUrlTemplate
termsOfServiceUrl
privacyPolicyUrl
refundPolicyUrl
shippingPolicyUrl
cookiePolicyUrl
imprintUrl
faqUrl
contactUrl
}
createdAt
lastModifiedAt
custom {
typeRef
type
}
createdBy {
isPlatformClient
clientId
externalUserId
anonymousId
customerRef
userRef
associateRef
attributedTo
}
lastModifiedBy {
isPlatformClient
clientId
externalUserId
anonymousId
customerRef
userRef
associateRef
attributedTo
}
}
discountGroup {
id
version
key
sortOrder
isActive
nameAllLocales {
locale
value
}
descriptionAllLocales {
locale
value
}
createdAt
lastModifiedAt
createdBy {
isPlatformClient
clientId
externalUserId
anonymousId
customerRef
userRef
associateRef
attributedTo
}
lastModifiedBy {
isPlatformClient
clientId
externalUserId
anonymousId
customerRef
userRef
associateRef
attributedTo
}
}
value {
type
}
target {
type
}
sortOrder
recurringOrderScope {
type
}
id
version
createdAt
lastModifiedAt
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.
{
"draft": {
"value": {
"relative": {
"permyriad": "string"
},
"relativeCart": {
"permyriad": "string",
"applicationMode": "string"
},
"absolute": {
"money": "string"
},
"absoluteCart": {
"money": "string",
"applicationMode": "string"
},
"fixed": {
"money": "string"
},
"fixedCart": {
"money": "string",
"applicationMode": "string"
},
"giftLineItem": {
"product": "string",
"variantId": "string",
"distributionChannel": "string",
"supplyChannel": "string"
}
},
"cartPredicate": "string",
"name": [
{
"locale": "string",
"value": "string"
}
],
"target": {
"lineItems": {
"predicate": "string"
},
"customLineItems": {
"predicate": "string"
},
"shipping": {
"dummy": "string"
},
"multiBuyLineItems": {
"predicate": "string",
"triggerQuantity": "string",
"discountedQuantity": "string",
"maxOccurrence": "string",
"selectionMode": "string"
},
"multiBuyCustomLineItems": {
"predicate": "string",
"triggerQuantity": "string",
"discountedQuantity": "string",
"maxOccurrence": "string",
"selectionMode": "string"
},
"totalPrice": {
"dummy": "string"
},
"pattern": {
"triggerPattern": "string",
"targetPattern": "string",
"maxOccurrence": "string",
"selectionMode": "string"
}
},
"sortOrder": "string",
"description": [
{
"locale": "string",
"value": "string"
}
],
"validFrom": "string",
"validUntil": "string",
"stackingMode": "Stacking",
"requiresDiscountCode": false,
"isActive": false,
"custom": {
"typeId": "string",
"typeKey": "string",
"type": {
"typeId": "string",
"id": "string",
"key": "string"
},
"fields": [
"string"
]
}
},
"storeKey": "string"
}
Response
Read the result with {{createcartdiscount.response.data.data.createCartDiscount}}. If the API returns errors, the step fails and they are at {{createcartdiscount.response.data.errors}}.
Need more? See the Commercetools guide for connection setup and behaviour shared by every action.
Was this page helpful?