Product Discounts reduce certain Product Prices.
500 Product Discounts can be active at the same time.The time to update can vary—between a fraction of a second to several hours—depending on the following factors:
- The number of Products and their size
- The number of Products affected by Discount predicates
- The number of Prices to be updated
Representations
ProductDiscount
idString | Unique identifier of the ProductDiscount. |
versionInt | Current version of the ProductDiscount. |
keyString | User-defined unique identifier of the ProductDiscount. MinLength:2MaxLength: 256Pattern: ^[A-Za-z0-9_-]+$ |
name | Name of the ProductDiscount. |
description | Description of the ProductDiscount. |
value | Type of Discount and its corresponding value. |
predicateString | Valid ProductDiscount predicate. |
sortOrderString | Unique decimal value between 0 and 1 (stored as String literal) defining the order of Product Discounts to apply in case more than one is applicable and active. A Product Discount with a higher value is prioritized. |
isActiveBoolean | If true the Product Discount is applied to Products matching the predicate. |
referencesArray of Reference | References of all the resources that are addressed in the predicate. |
validFrom | Date and time (UTC) from which the Discount is effective.
Take Eventual Consistency into account for calculated discount values. |
validUntil | Date and time (UTC) until which the Discount is effective.
Take Eventual Consistency into account for calculated undiscounted values. |
createdAt | Date and time (UTC) the ProductDiscount was initially created. |
createdByBETA | IDs and references that created the ProductDiscount. |
lastModifiedAt | Date and time (UTC) the ProductDiscount was last updated. |
lastModifiedByBETA | IDs and references that last modified the ProductDiscount. |
{
"id": "{{product-discount-id}}",
"version": 1,
"key": "summer-sale",
"name": {
"en": "Summer Sale"
},
"description": {
"en": "1€ off all products"
},
"value": {
"type": "absolute",
"money": [
{
"type": "centPrecision",
"currencyCode": "EUR",
"centAmount": 100,
"fractionDigits": 2
}
]
},
"predicate": "(product.id = \"{{product-id}}\" and variant.id = 1) or variant.key = \"{{product-variant-key}}\" or attributes.label = \"{{product-attribute-label}}\"",
"sortOrder": "0.9534",
"isActive": true,
"references": [
{
"typeId": "product",
"id": "{{product-id}}"
}
],
"createdAt": "2024-11-21T10:44:07.587Z",
"lastModifiedAt": "2024-11-21T10:44:07.587Z",
"lastModifiedBy": {
"clientId": "{{client-id}}",
"isPlatformClient": false
},
"createdBy": {
"clientId": "{{client-id}}",
"isPlatformClient": false
}
}ProductDiscountDraft
keyString | User-defined unique identifier for the ProductDiscount. MinLength:2MaxLength: 256Pattern: ^[A-Za-z0-9_-]+$ |
name | Name of the ProductDiscount. |
description | Description of the ProductDiscount. |
value | Type of Discount and its corresponding value. |
predicateString | Valid ProductDiscount predicate. |
sortOrderString | Decimal value between 0 and 1 (passed as String literal) that defines the order of ProductDiscounts to apply in case more than one is applicable and active. A ProductDiscount with a higher sortOrder is prioritized.
The value must be unique among all ProductDiscounts in the Project. |
isActiveBoolean | Set to true to activate the ProductDiscount, set to false to deactivate it (even though the predicate matches). |
validFrom | Date and time (UTC) from which the Discount is effective.
Take Eventual Consistency into account for calculated discount values. |
validUntil | Date and time (UTC) until which the Discount is effective.
Take Eventual Consistency into account for calculated undiscounted values. |
{
"key": "summer-sale",
"name": {
"en": "Summer Sale"
},
"description": {
"en": "1€ off all products"
},
"value": {
"type": "absolute",
"money": [
{
"currencyCode": "EUR",
"centAmount": 100
}
]
},
"predicate": "(product.id = \"{{product-id}}\" and variant.id = 1) or variant.key = \"{{product-variant-key}}\" or attributes.label = \"{{product-attribute-label}}\"",
"sortOrder": "0.9534",
"isActive": true
}ProductDiscountPagedQueryResponse
limitInt | Number of results requested. Default: 20Minimum: 0Maximum: 500 |
offsetInt | Number of elements skipped. Default: 0Maximum: 10000 |
countInt | Actual number of results returned. |
totalInt | Total number of results matching the query.
This number is an estimation that is not strongly consistent.
This field is returned by default.
For improved performance, calculating this field can be deactivated by using the query parameter withTotal=false.
When the results are filtered with a Query Predicate, total is subject to a limit. |
resultsArray of ProductDiscount | ProductDiscounts matching the query. |
ProductDiscountReference
idString | Unique identifier of the referenced ProductDiscount. |
typeId | product-discountType of referenced resource. |
obj | Contains the representation of the expanded ProductDiscount. Only present in responses to requests with Reference Expansion for ProductDiscounts. |
ProductDiscountKeyReference
keyString | User-defined unique identifier of the referenced ProductDiscount. |
typeId | product-discountType of referenced resource. |
ProductDiscountResourceIdentifier
id or key is required. If both are set, an InvalidJsonInput error is returned.idString | Unique identifier of the referenced ProductDiscount. Required if key is absent. |
keyString | User-defined unique identifier of the referenced ProductDiscount. Required if id is absent. |
typeId | product-discountType of referenced resource. If given, it must match the expected ReferenceTypeId of the referenced resource. |
ProductDiscountValue
ProductDiscountValueRelative
permyriad field.typeString | "relative" |
permyriadInt | Fraction (per ten thousand) the price is reduced by. For example, 1000 will result in a 10% price reduction. |
{
"type": "relative",
"permyriad": 1000
}ProductDiscountValueAbsolute
money field.typeString | "absolute" |
moneyArray of CentPrecisionMoney | Money values in different currencies. An absolute ProductDiscount will only match a price if this array contains a value with the same currency. For example, if it contains 10€ and 15$, the matching € price will be decreased by 10€ and the matching $ price will be decreased by 15$. |
{
"type": "absolute",
"money": [
{
"type": "centPrecision",
"currencyCode": "EUR",
"centAmount": 100,
"fractionDigits": 2
}
]
}ProductDiscountValueExternal
typeString | "external" |
{
"type": "external"
}ProductDiscountValueDraft
ProductDiscountValueRelativeDraft
permyriad field.typeString | "relative" |
permyriadInt | Fraction (per ten thousand) the price is reduced by. For example, 1000 will result in a 10% price reduction. |
{
"type": "relative",
"permyriad": 1000
}ProductDiscountValueAbsoluteDraft
money field.typeString | "absolute" |
moneyArray of Money | Money values in different currencies. An absolute Product Discount will match a price only if the array contains a value with the same currency. For example, if it contains 10€ and 15$, the matching € price will be decreased by 10€ and the matching $ price will be decreased by 15$. If the value exceeds the price of a Product Variant, the discounted price (of the Product Variant) will be a negative value. If the array is empty or has multiple values of the same currency, the API returns an InvalidOperation error. |
{
"type": "absolute",
"money": [
{
"currencyCode": "EUR",
"centAmount": 100
}
]
}ProductDiscountValueExternalDraft
typeString | "external" |
{
"type": "external"
}ProductDiscountMatchQuery
productIdString | ID of the specified Product. |
variantIdInt | ID of the specified Product Variant. |
stagedBoolean | Controls which projected representation is applied for the query.
Set to true for the staged Product Projection of the specified Product Variant, set to false for the current one. |
price | Specified Price of the specified Product Variant. |
{
"productId": "{{product-id}}",
"variantId": 1,
"staged": false,
"price": {
"id": "{{price-id}}",
"value": {
"currencyCode": "EUR",
"centAmount": 10000
},
"country": "DE",
"customerGroup": {
"typeId": "customer-group",
"id": "{{customer-group-id}}"
},
"tiers": [
{
"minimumQuantity": 10,
"value": {
"currencyCode": "EUR",
"centAmount": 9000
}
}
]
}
}QueryPrice
idString | Unique identifier of the given Price. |
value | Money value of the given Price. |
country | Country for which the given Price is valid. Pattern:^[A-Z]{2}$ |
customerGroup | CustomerGroup for which the given Price is valid. |
channel | ProductDistribution Channel for which the given Price is valid. |
validFrom | Date from which the given Price is valid. |
validUntil | Date until which the given Price is valid. |
discounted | DiscountedPrice you specify for the given Price. |
tiersArray of PriceTierDraft | Price tier applied when the minimum quantity for the LineItem of a ProductVariant with the related Price is reached in a Cart.
If discounted is specified, the tiered Price is ignored for a Product Variant. |
custom | Custom Fields for the Price. |
{
"id": "{{price-id}}",
"value": {
"currencyCode": "EUR",
"centAmount": 10000
},
"country": "DE",
"customerGroup": {
"typeId": "customer-group",
"id": "{{customer-group-id}}"
},
"tiers": [
{
"minimumQuantity": 10,
"value": {
"currencyCode": "EUR",
"centAmount": 9000
}
}
]
}Get ProductDiscount
Get ProductDiscount by ID
view_products:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString | key of the Project. |
idString | id of the ProductDiscount. |
expand | The parameter can be passed multiple times. |
application/jsoncurl --get https://api.{region}.commercetools.com/{projectKey}/product-discounts/{id} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" {
"id": "{{product-discount-id}}",
"version": 1,
"key": "summer-sale",
"name": {
"en": "Summer Sale"
},
"description": {
"en": "1€ off all products"
},
"value": {
"type": "absolute",
"money": [
{
"type": "centPrecision",
"currencyCode": "EUR",
"centAmount": 100,
"fractionDigits": 2
}
]
},
"predicate": "(product.id = \"{{product-id}}\" and variant.id = 1) or variant.key = \"{{product-variant-key}}\" or attributes.label = \"{{product-attribute-label}}\"",
"sortOrder": "0.9534",
"isActive": true,
"references": [
{
"typeId": "product",
"id": "{{product-id}}"
}
],
"createdAt": "2024-11-21T10:44:07.587Z",
"lastModifiedAt": "2024-11-21T10:44:07.587Z",
"lastModifiedBy": {
"clientId": "{{client-id}}",
"isPlatformClient": false
},
"createdBy": {
"clientId": "{{client-id}}",
"isPlatformClient": false
}
}Get ProductDiscount by Key
view_products:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString | key of the Project. |
keyString | key of the ProductDiscount. |
expand | The parameter can be passed multiple times. |
application/jsoncurl --get https://api.{region}.commercetools.com/{projectKey}/product-discounts/key={key} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" {
"id": "{{product-discount-id}}",
"version": 1,
"key": "summer-sale",
"name": {
"en": "Summer Sale"
},
"description": {
"en": "1€ off all products"
},
"value": {
"type": "absolute",
"money": [
{
"type": "centPrecision",
"currencyCode": "EUR",
"centAmount": 100,
"fractionDigits": 2
}
]
},
"predicate": "(product.id = \"{{product-id}}\" and variant.id = 1) or variant.key = \"{{product-variant-key}}\" or attributes.label = \"{{product-attribute-label}}\"",
"sortOrder": "0.9534",
"isActive": true,
"references": [
{
"typeId": "product",
"id": "{{product-id}}"
}
],
"createdAt": "2024-11-21T10:44:07.587Z",
"lastModifiedAt": "2024-11-21T10:44:07.587Z",
"lastModifiedBy": {
"clientId": "{{client-id}}",
"isPlatformClient": false
},
"createdBy": {
"clientId": "{{client-id}}",
"isPlatformClient": false
}
}Query ProductDiscounts
view_products:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString | key of the Project. |
where | The parameter can be passed multiple times. |
sort | The parameter can be passed multiple times. |
expand | The parameter can be passed multiple times. |
limitInt | Number of results requested. Default: 20Minimum: 0Maximum: 500 |
offsetInt | Number of elements skipped. Default: 0Maximum: 10000 |
withTotalBoolean | Controls the calculation of the total number of query results. Set to false to improve query performance when the total is not needed.Default: true |
var.<varName>String | Predicate parameter values. The parameter can be passed multiple times. |
ProductDiscountPagedQueryResponse
asapplication/jsoncurl --get https://api.{region}.commercetools.com/{projectKey}/product-discounts -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" {
"limit": 20,
"offset": 0,
"count": 1,
"total": 1,
"results": [
{
"id": "{{product-discount-id}}",
"version": 1,
"key": "summer-sale",
"name": {
"en": "Summer Sale"
},
"description": {
"en": "1€ off all products"
},
"value": {
"type": "absolute",
"money": [
{
"type": "centPrecision",
"currencyCode": "EUR",
"centAmount": 100,
"fractionDigits": 2
}
]
},
"predicate": "(product.id = \"{{product-id}}\" and variant.id = 1) or variant.key = \"{{product-variant-key}}\"",
"sortOrder": "0.9534",
"isActive": true,
"references": [
{
"typeId": "product",
"id": "464af704-78f7-4d39-9a1c-d00a6f3234b3"
}
],
"createdAt": "2024-11-21T10:44:07.587Z",
"lastModifiedAt": "2024-11-21T10:44:07.587Z",
"lastModifiedBy": {
"clientId": "{{client-id}}",
"isPlatformClient": false
},
"createdBy": {
"clientId": "{{client-id}}",
"isPlatformClient": false
}
}
]
}Check if ProductDiscount exists
Check if ProductDiscount exists by ID
id. Returns a 200 status if the ProductDiscount exists, or a 404 status otherwise.view_products:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString | key of the Project. |
idString | id of the ProductDiscount. |
curl --head https://api.{region}.commercetools.com/{projectKey}/product-discounts/{id} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" Check if ProductDiscount exists by Key
key. Returns a 200 status if the ProductDiscount exists, or a 404 status otherwise.view_products:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString | key of the Project. |
keyString | key of the ProductDiscount. |
curl --head https://api.{region}.commercetools.com/{projectKey}/product-discounts/key={key} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" Check if ProductDiscount exists by Query Predicate
200 status if any ProductDiscounts match the query predicate, or a 404 status otherwise.view_products:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString | key of the Project. |
where | The parameter can be passed multiple times. |
curl --head https://api.{region}.commercetools.com/{projectKey}/product-discounts -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" Create ProductDiscount
manage_products:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString | key of the Project. |
expand | The parameter can be passed multiple times. |
application/jsonapplication/jsoncurl https://api.{region}.commercetools.com/{projectKey}/product-discounts -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" \
--header 'Content-Type: application/json' \
--data-binary @- << DATA
{
"key" : "summer-sale",
"name" : {
"en" : "Summer Sale"
},
"description" : {
"en" : "1€ off all products"
},
"value" : {
"type" : "absolute",
"money" : [ {
"currencyCode" : "EUR",
"centAmount" : 100
} ]
},
"predicate" : "(product.id = "{{product-id}}" and variant.id = 1) or variant.key = "{{product-variant-key}}" or attributes.label = "{{product-attribute-label}}"",
"sortOrder" : "0.9534",
"isActive" : true
}
DATA{
"id": "{{product-discount-id}}",
"version": 1,
"key": "summer-sale",
"name": {
"en": "Summer Sale"
},
"description": {
"en": "1€ off all products"
},
"value": {
"type": "absolute",
"money": [
{
"type": "centPrecision",
"currencyCode": "EUR",
"centAmount": 100,
"fractionDigits": 2
}
]
},
"predicate": "(product.id = \"{{product-id}}\" and variant.id = 1) or variant.key = \"{{product-variant-key}}\" or attributes.label = \"{{product-attribute-label}}\"",
"sortOrder": "0.9534",
"isActive": true,
"references": [
{
"typeId": "product",
"id": "{{product-id}}"
}
],
"createdAt": "2024-11-21T10:44:07.587Z",
"lastModifiedAt": "2024-11-21T10:44:07.587Z",
"lastModifiedBy": {
"clientId": "{{client-id}}",
"isPlatformClient": false
},
"createdBy": {
"clientId": "{{client-id}}",
"isPlatformClient": false
}
}Update ProductDiscount
Update ProductDiscount by ID
manage_products:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString | key of the Project. |
idString | id of the ProductDiscount. |
expand | The parameter can be passed multiple times. |
application/jsonversionInt | Expected version of the ProductDiscount on which the changes should be applied.
If the expected version does not match the actual version, a ConcurrentModification error will be returned. |
actionsArray of ProductDiscountUpdateAction | Update actions to be performed on the ProductDiscount. |
application/jsoncurl https://api.{region}.commercetools.com/{projectKey}/product-discounts/{id} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" \
--header 'Content-Type: application/json' \
--data-binary @- << DATA
{
"version" : 1,
"actions" : [ {
"action" : "changeValue",
"value" : {
"type" : "absolute",
"money" : [ {
"currencyCode" : "EUR",
"centAmount" : 200
} ]
}
} ]
}
DATA{
"id": "{{product-discount-id}}",
"version": 2,
"key": "summer-sale",
"name": {
"en": "Summer Sale"
},
"description": {
"en": "1€ off all products"
},
"value": {
"type": "absolute",
"money": [
{
"type": "centPrecision",
"currencyCode": "EUR",
"centAmount": 200,
"fractionDigits": 2
}
]
},
"predicate": "(product.id = \"{{product-id}}\" and variant.id = 1) or variant.key = \"{{product-variant-key}}\"",
"sortOrder": "0.9534",
"isActive": true,
"references": [
{
"typeId": "product",
"id": "464af704-78f7-4d39-9a1c-d00a6f3234b3"
}
],
"createdAt": "2024-11-21T10:44:07.587Z",
"lastModifiedAt": "2024-12-21T10:44:07.587Z",
"lastModifiedBy": {
"clientId": "{{client-id}}",
"isPlatformClient": false
},
"createdBy": {
"clientId": "{{client-id}}",
"isPlatformClient": false
}
}Update ProductDiscount by Key
manage_products:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString | key of the Project. |
keyString | key of the ProductDiscount. |
expand | The parameter can be passed multiple times. |
application/jsonversionInt | Expected version of the ProductDiscount on which the changes should be applied.
If the expected version does not match the actual version, a ConcurrentModification error will be returned. |
actionsArray of ProductDiscountUpdateAction | Update actions to be performed on the ProductDiscount. |
application/jsoncurl https://api.{region}.commercetools.com/{projectKey}/product-discounts/key={key} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" \
--header 'Content-Type: application/json' \
--data-binary @- << DATA
{
"version" : 1,
"actions" : [ {
"action" : "changeValue",
"value" : {
"type" : "absolute",
"money" : [ {
"currencyCode" : "EUR",
"centAmount" : 200
} ]
}
} ]
}
DATA{
"id": "{{product-discount-id}}",
"version": 2,
"key": "summer-sale",
"name": {
"en": "Summer Sale"
},
"description": {
"en": "1€ off all products"
},
"value": {
"type": "absolute",
"money": [
{
"type": "centPrecision",
"currencyCode": "EUR",
"centAmount": 200,
"fractionDigits": 2
}
]
},
"predicate": "(product.id = \"{{product-id}}\" and variant.id = 1) or variant.key = \"{{product-variant-key}}\"",
"sortOrder": "0.9534",
"isActive": true,
"references": [
{
"typeId": "product",
"id": "464af704-78f7-4d39-9a1c-d00a6f3234b3"
}
],
"createdAt": "2024-11-21T10:44:07.587Z",
"lastModifiedAt": "2024-12-21T10:44:07.587Z",
"lastModifiedBy": {
"clientId": "{{client-id}}",
"isPlatformClient": false
},
"createdBy": {
"clientId": "{{client-id}}",
"isPlatformClient": false
}
}Update actions
Set Key
actionString | "setKey" |
keyString | Value to set. If empty, any existing value will be removed. MinLength:2MaxLength: 256Pattern: ^[A-Za-z0-9_-]+$ |
{
"action": "setKey",
"key": "new-key"
}Change Value
actionString | "changeValue" |
value | New value to set. Must not be empty. |
{
"action": "changeValue",
"value": {
"type": "relative",
"permyriad": 2000
}
}Change Predicate
actionString | "changePredicate" |
predicateString | New value to set. Must be a valid ProductDiscount predicate. |
{
"action": "changePredicate",
"predicate": "product.id = \"{{product-id}}\""
}Change Is Active
actionString | "changeIsActive" |
isActiveBoolean | New value to set.
If set to true, the Discount will be applied to Product Prices. |
{
"action": "changeIsActive",
"isActive": false
}Set Valid From
actionString | "setValidFrom" |
validFrom | Value to set.
If empty, any existing value will be removed.
Take Eventual Consistency into account for calculated discount values. |
{
"action": "setValidFrom",
"validFrom": "2025-10-12T14:05:00.000Z"
}Set Valid Until
actionString | "setValidUntil" |
validUntil | Value to set.
If empty, any existing value will be removed.
Take Eventual Consistency into account for calculated undiscounted values. |
{
"action": "setValidUntil",
"validUntil": "2025-11-12T14:05:00.000Z"
}Set Valid From and Until
actionString | "setValidFromAndUntil" |
validFrom | Value to set.
Take Eventual Consistency into account for calculated undiscounted values. |
validUntil | Value to set.
Take Eventual Consistency into account for calculated undiscounted values. |
{
"action": "setValidFromAndUntil",
"validFrom": "2025-10-12T14:00:00.000Z",
"validUntil": "2025-11-12T14:05:00.000Z"
}Change Name
actionString | "changeName" |
name | New value to set. Must not be empty. |
{
"action": "changeName",
"name": {
"de": "Neuer Rabatt",
"en": "New discount"
}
}Set Description
actionString | "setDescription" |
description | Value to set. If empty, any existing value will be removed. |
{
"action": "setDescription",
"description": {
"de": "Neue Beschreibung",
"en": "New description"
}
}Change Sort Order
actionString | "changeSortOrder" |
sortOrderString | New value to set.
Must not be empty.
The string value must be a number between 0 and 1.
A Discount with a higher sortOrder is prioritized. |
{
"action": "changeSortOrder",
"sortOrder": "0.3"
}Delete ProductDiscount
Delete ProductDiscount by ID
manage_products:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString | key of the Project. |
idString | id of the ProductDiscount. |
versionInt | Last seen version of the resource. |
expand | The parameter can be passed multiple times. |
application/jsoncurl -X DELETE https://api.{region}.commercetools.com/{projectKey}/product-discounts/{id}?version={version} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}"{
"id": "{{product-discount-id}}",
"version": 1,
"key": "summer-sale",
"name": {
"en": "Summer Sale"
},
"description": {
"en": "1€ off all products"
},
"value": {
"type": "absolute",
"money": [
{
"type": "centPrecision",
"currencyCode": "EUR",
"centAmount": 100,
"fractionDigits": 2
}
]
},
"predicate": "(product.id = \"{{product-id}}\" and variant.id = 1) or variant.key = \"{{product-variant-key}}\" or attributes.label = \"{{product-attribute-label}}\"",
"sortOrder": "0.9534",
"isActive": true,
"references": [
{
"typeId": "product",
"id": "{{product-id}}"
}
],
"createdAt": "2024-11-21T10:44:07.587Z",
"lastModifiedAt": "2024-11-21T10:44:07.587Z",
"lastModifiedBy": {
"clientId": "{{client-id}}",
"isPlatformClient": false
},
"createdBy": {
"clientId": "{{client-id}}",
"isPlatformClient": false
}
}Delete ProductDiscount by Key
manage_products:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString | key of the Project. |
keyString | key of the ProductDiscount. |
versionInt | Last seen version of the resource. |
expand | The parameter can be passed multiple times. |
application/jsoncurl -X DELETE https://api.{region}.commercetools.com/{projectKey}/product-discounts/key={key}?version={version} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}"{
"id": "{{product-discount-id}}",
"version": 1,
"key": "summer-sale",
"name": {
"en": "Summer Sale"
},
"description": {
"en": "1€ off all products"
},
"value": {
"type": "absolute",
"money": [
{
"type": "centPrecision",
"currencyCode": "EUR",
"centAmount": 100,
"fractionDigits": 2
}
]
},
"predicate": "(product.id = \"{{product-id}}\" and variant.id = 1) or variant.key = \"{{product-variant-key}}\" or attributes.label = \"{{product-attribute-label}}\"",
"sortOrder": "0.9534",
"isActive": true,
"references": [
{
"typeId": "product",
"id": "{{product-id}}"
}
],
"createdAt": "2024-11-21T10:44:07.587Z",
"lastModifiedAt": "2024-11-21T10:44:07.587Z",
"lastModifiedBy": {
"clientId": "{{client-id}}",
"isPlatformClient": false
},
"createdBy": {
"clientId": "{{client-id}}",
"isPlatformClient": false
}
}Get Matching ProductDiscount
view_products:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString | key of the Project. |
application/jsonapplication/jsoncurl https://api.{region}.commercetools.com/{projectKey}/product-discounts/matching -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" \
--header 'Content-Type: application/json' \
--data-binary @- << DATA
{
"productId" : "{{product-id}}",
"variantId" : 1,
"staged" : false,
"price" : {
"id" : "{{price-id}}",
"value" : {
"currencyCode" : "EUR",
"centAmount" : 10000
},
"country" : "DE",
"customerGroup" : {
"typeId" : "customer-group",
"id" : "{{customer-group-id}}"
},
"tiers" : [ {
"minimumQuantity" : 10,
"value" : {
"currencyCode" : "EUR",
"centAmount" : 9000
}
} ]
}
}
DATA{
"id": "{{product-discount-id}}",
"version": 1,
"key": "summer-sale",
"name": {
"en": "Summer Sale"
},
"description": {
"en": "1€ off all products"
},
"value": {
"type": "absolute",
"money": [
{
"type": "centPrecision",
"currencyCode": "EUR",
"centAmount": 100,
"fractionDigits": 2
}
]
},
"predicate": "(product.id = \"{{product-id}}\" and variant.id = 1) or variant.key = \"{{product-variant-key}}\" or attributes.label = \"{{product-attribute-label}}\"",
"sortOrder": "0.9534",
"isActive": true,
"references": [
{
"typeId": "product",
"id": "{{product-id}}"
}
],
"createdAt": "2024-11-21T10:44:07.587Z",
"lastModifiedAt": "2024-11-21T10:44:07.587Z",
"lastModifiedBy": {
"clientId": "{{client-id}}",
"isPlatformClient": false
},
"createdBy": {
"clientId": "{{client-id}}",
"isPlatformClient": false
}
}