commercetools icon

commercetools

Interact with the commercetools API. Operations are auto-generated from the official Postman collection.

Actions671

Cart Discount → Create CartDiscount

AI-generated

Summary

Create a new Cart Discount in commercetools by specifying key details such as name, description, discount value, predicate conditions, target settings, sorting order, applicable stores, activation status, discount code requirement, and stacking mode.

Inputs

  • Key (required) — Unique identifier for the Cart Discount.
  • Name (required) — Localized name of the Cart Discount (JSON object with language keys).
  • Description (required) — Localized description of the Cart Discount (JSON object with language keys).
  • Value › Type — Type of discount value to apply (e.g., relative or absolute discount).
  • Value › Permyriad — Discount amount expressed in permyriad (parts per ten thousand).
  • Cart Predicate (required) — Predicate (condition) defining when the discount applies to a cart.
  • Target › Type — Type of discount target (defines what the discount applies to).
  • Target › Predicate — Predicate defining specific target criteria for the discount.
  • Sort Order (required) — String defining the discount's sort order relative to others.
  • Stores (required) — JSON array of store references where the discount is valid.
  • Is Active (required) — Boolean flag indicating if the discount is active.
  • Requires Discount Code (required) — Boolean flag indicating if a discount code is required to apply the discount.
  • Stacking Mode (required) — Defines how this discount stacks with other discounts.

Output shape

a single JSON object representing the created Cart Discount as returned from the commercetools API.

The output contains all the properties of the newly created Cart Discount. Errors during creation will throw exceptions unless "Continue On Fail" mode is enabled, which returns error details per item.

Examples

Example 1: Creating a 10% relative cart discount active for specific stores

Set 'Key' to a unique identifier, 'Name' and 'Description' to localized strings, 'Value › Type' to 'relative', 'Value › Permyriad' to 1000 (10%), provide a 'Cart Predicate' defining applicability, set the 'Sort Order', specify applicable 'Stores' as a JSON array, set 'Is Active' to true, 'Requires Discount Code' to false, and define 'Stacking Mode' as needed.

Links

Discussion