commercetools icon

commercetools

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

Actions671

Product-discount → Get Matching ProductDiscount

AI-generated

Summary

Retrieve the product discount from commercetools that matches given product and variant details, optionally specifying pricing context for accurate discount matching.

Inputs

  • Product Id (required) — The unique identifier of the product for which to find a matching product discount.
  • Variant Id (required) — The identifier of the product variant to consider when finding the matching discount.
  • Staged (required) — Boolean flag specifying whether to use staged data (true) or current data (false) in the matching process.
  • Price › Id — Optional price identifier to provide context for discount matching.
  • Price › Value › Currency Code — Currency code indicating the currency of the price value.
  • Price › Value › Cent Amount — Price value in the smallest currency unit (e.g., cents).
  • Price › Country — Country associated with the price, used for scope of discount.
  • Price › Customer Group › Type Id — Type identifier of the customer group relevant for discount evaluation.
  • Price › Customer Group › Id — Identifier of the customer group associated with the price.
  • Price › Tiers — Optional JSON array specifying price tiers relevant to the discount matching.

Output shape

a single record representing the product discount that matches the specified product, variant, and optional pricing details.

The output is a JSON object returned from the commercetools API's matching product discount endpoint. If no matching discount is found, the response may be empty or not returned, depending on the API behavior. The operation requires valid commercetools OAuth2 credentials and may throw errors if authentication fails or required parameters are missing.

Examples

Example 1: Find discount for a product variant with staged data

Set Product Id and Variant Id for the product variant, set Staged to true, leave optional price details empty if not needed.

Links

Discussion