Alokai

removeCouponFromBasket

Removes a coupon from the basket.

This method communicates with the removeCouponFromBasket endpoint of the Vue Storefront API Middleware. In turn, it receives data from the removeCouponFromBasket or the Remove coupon from basket endpoints exposed by SCAPI / OCAPI depending on the middleware configuration.

Signature

export declare function removeCouponFromBasket(
	props: BasketCouponRemoveParams & {
    basketId?: string;
}
): Promise<import("commerce-sdk/dist/checkout/checkout").ShopperBaskets.Basket>;

Parameters

NameRequiredTypeDescription
propsRequiredBasketCouponRemoveParams & { basketId?: string; }Parameter object which can be used with this method. Refer to its type definition to learn about possible properties.

Returns

Returns a representation of a Basket object.

Referenced Types

  • BasketCouponRemoveParams
  • ShopperBaskets.Basket

Examples

Removing a coupon code by couponItemId.

import { sdk } from '~/sdk.config.ts';

const basketId  = (await sdk.commerce.getBasket()).basketId;

const updatedBasket = await sdk.commerce.removeCouponFromBasket({ couponItemId: 'couponItemId', basketId  });

On this page