Vue Storefront is now Alokai! Learn More
RemoveCouponFromCart

RemoveCouponFromCart

Implements RemoveCouponFromCart Unified Method.

Source

import { defineApi, getNormalizedCart } from "@vsf-enterprise/unified-api-sfcc";
import from "@vsf-enterprise/unified-api-sfcc/udl";

declare module "@vsf-enterprise/unified-api-sfcc" {
  interface RemoveCouponFromCartExtendedArgs {}
}


export const removeCouponFromCart = defineApi.removeCouponFromCart(async (context, args) => {
  const { couponId, cartId } = args;

  const cart = await context.api.removeCouponFromBasket({
    basketId: cartId,
    couponItemId: couponId,
  });

  return await getNormalizedCart(context, cart);
});