commercetools icon

commercetools

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

Actions671

Store Cart Discount → Check if CartDiscount exists in Store by Key

AI-generated

Summary

Check whether a Cart Discount with a specified key exists in a given commercetools store by performing a HEAD request to the Cart Discount resource identified by the store and discount keys.

Inputs

  • Store Cart Discount Key (required) — The unique key identifying the Cart Discount to check for existence.
  • Store Key (required) — The key of the store in which to check for the Cart Discount.
  • Cart Discount Key (required) — The key of the Cart Discount within the store to verify existence.

Output shape

a single JSON object indicating existence

Returns an object containing 'exists' (boolean), 'statusCode' (numeric HTTP status), and 'url' (string). If the Cart Discount exists, 'exists' is true with statusCode 200; if not found, 'exists' is false with statusCode 404. Errors other than 404 are thrown as NodeApiError.

Examples

Example 1: Check if a Cart Discount with key 'summer-sale' exists in store 'main-store'

Provide 'summer-sale' as Store Cart Discount Key, 'main-store' as Store Key, and 'summer-sale' as Cart Discount Key.

Links

Discussion