22 August 2024
Pricing and DiscountsGraphQL
You can now choose how absolute discounts are applied to (Custom) Line Items in a Cart. Discounts can be distributed evenly or applied individually to each (Custom) Line Item, giving you more flexibility when creating promotions. Previously, discounts were only distributed proportionately to (Custom) Line Items.
Changes:
- [API] Added DiscountApplicationMode to the Cart Discounts API.
- [API] Added
applicationModefield to CartDiscountValueAbsoluteDraft and CartDiscountValueAbsolute. - [GraphQL API] Added the following types to the GraphQL schema:
AbsoluteCartDiscountValue,AbsoluteCartDiscountValueInput, andDiscountApplicationMode. - [GraphQL API] Added
absoluteCartinput field to theCartDiscountValueInputtype.
The following changes were introduced in terms of GraphQL SDL:
extend input CartDiscountValueInput {
absoluteCart: AbsoluteCartDiscountValueInput
}
type AbsoluteCartDiscountValue implements CartDiscountValue {
money: [Money!]!
applicationMode: DiscountApplicationMode!
type: String!
}
input AbsoluteCartDiscountValueInput {
money: [MoneyInput!]!
applicationMode: DiscountApplicationMode!
}
enum DiscountApplicationMode {
ProportionateDistribution
EvenDistribution
IndividualApplication
}