commercetools icon

commercetools

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

Actions671

Store Cart Discount → Create CartDiscount in Store

AI-generated

Summary

Create a new CartDiscount resource in a specified commercetools store by providing detailed discount configuration parameters.

Inputs

  • Store Cart Discount Key (required) — The key identifying the store cart discount resource within the commercetools project.
  • Store Key (required) — The key of the store where the CartDiscount will be created.
  • Key (required) — Unique identifier key for the new CartDiscount.
  • Name (required) — Localized names of the CartDiscount as JSON object, e.g., { "en": "Discount Name" }.
  • Description (required) — Localized descriptions of the CartDiscount as JSON object.
  • Value › Type — Type of discount value to apply (e.g., absolute, relative).
  • Value › Permyriad — Value of the discount expressed in permyriad (parts per ten thousand).
  • Cart Predicate (required) — A predicate string that determines which carts the discount applies to.
  • Target › Type — Type of target the discount applies to (e.g., line items).
  • Target › Predicate — Predicate string specifying which cart elements are targeted by the discount.
  • Sort Order (required) — Determines the order in which this discount is applied relative to others, represented as a string.
  • Stores (required) — JSON array of store references relevant to the discount.
  • Is Active (required) — Boolean flag to activate or deactivate the discount upon creation.
  • Requires Discount Code (required) — Boolean flag to specify if a discount code is required to activate this discount.
  • Stacking Mode (required) — Determines how this discount stacks with others (e.g., standalone, stacking).

Output shape

a single JSON object representing the created CartDiscount resource

The output includes the full details of the newly created CartDiscount as returned by the commercetools API, including all configured properties and system-generated fields.

Examples

Example 1: Create a 10% discount applicable to carts with a specific condition in a given store

Provide the store key, unique discount key, a localized name and description, set 'Value Type' to percentage with 'Permyriad' 1000, specify the cart predicate, target details, sort order, applicable stores array, set 'Is Active' to true, 'Requires Discount Code' as needed, and define the stacking mode.

Links

Discussion