Alokai
You are reading the documentation for v7.x and earlier, which is no longer the latest version. Switch to v8.x

removeCartVoucher

Remove voucher from the cart in SAP Commerce Cloud.

This method exchanges data with the removeCartVoucher endpoint exposed by the SAP OCC API Cart Promotions Controller.

This method will work for all types of carts (anonymous, user and guest). In case of guest and anonymous carts, remember to pass cart guid as the cartId param. In case of a current user cart, pass cart code instead.

Signature

export declare function removeCartVoucher(
	context: SapccIntegrationContext,
	props: RemoveVoucherFromCartProps
): Promise<void>;

Parameters

NameRequiredTypeDescription
contextRequiredSapccIntegrationContext
propsRequiredRemoveVoucherFromCartPropsParameter object which can be used with this method. Refer to its type definition to learn about possible properties.

Returns

This method does not return anything.

Referenced Types

Examples

Removing voucher from the cart.

import { sdk } from '~/sdk';

await sdk.commerce.removeCartVoucher({ cartId: '00035084', voucherId: 'springfestival' });

On this page