28 September 2023
Pricing and DiscountsCartsOrdersGraphQL
You can now create Cart Discounts that target the total price of a Cart. With this enhancement, you can configure promotions such as spend 200€ and get 5€ off the cart total. Previously, this discount configuration was not supported.
Changes:
- [API] Added
discountOnTotalPrice
field to Cart and Order. - [API] Added DiscountOnTotalPrice and DiscountedTotalPricePortion to the Carts API.
- [API] Added CartDiscountTotalPriceTarget type to the Cart Discounts API.
- [GraphQL API] Added the following types to the GraphQL schema:
DiscountOnTotalPrice
,DiscountedTotalPricePortion
,CartDiscountTotalPriceTarget
. - [GraphQL API] Changed the
CartDiscountTargetInput
type:- Input field
totalPrice
was added toCartDiscountTargetInput
type
- Input field
- [GraphQL API] Changed the
Cart
andOrder
type:- Added the
discountOnTotalPrice
field to theCart
andOrder
type.
- Added the
The following changes were introduced in terms of GraphQL SDL:
extend type Cart {
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
discountOnTotalPrice: DiscountOnTotalPrice
}
extend type Order {
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
discountOnTotalPrice: DiscountOnTotalPrice
}
extend input CartDiscountTargetInput {
totalPrice: CartDiscountTotalPriceTargetInput
}
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
type CartDiscountTotalPriceTarget implements CartDiscountTarget {
type: String!
}
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
input CartDiscountTotalPriceTargetInput {
dummy: String
}
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
type DiscountOnTotalPrice {
discountedAmount: BaseMoney!
includedDiscounts: [DiscountedTotalPricePortion!]!
discountedNetAmount: BaseMoney
discountedGrossAmount: BaseMoney
}
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
type DiscountedTotalPricePortion {
discount: CartDiscount
discountRef: Reference!
discountedAmount: BaseMoney!
}