applyCartCoupon
Apply a discount code to the cart.
It uses the updateCart method to apply a discount code to the cart.
Signature
declare function applyCartCoupon(
context: CommercetoolsIntegrationContext,
params: ApplyCartCouponParams,
discountCode: string,
customQuery?: CustomQuery
): Promise<ApplyCartCouponResponse>;Parameters
| Name | Required | Type | Description |
|---|---|---|---|
context | Required | CommercetoolsIntegrationContext | |
params | Required | ApplyCartCouponParams | |
discountCode | Required | string | |
customQuery | Optional | CustomQuery |
Referenced Types
Examples
Applying a coupon to the cart.
const { cart } = await sdk.commerce.applyCartCoupon(
{ id: '6931b5d2-986f-4d2b-8cba-45007a26eb5e', version: '1' },
'code'
);