The Vue Storefront Essentials Course is now available! Learn More
RemoveCouponFromCart

RemoveCouponFromCart

Implements RemoveCouponFromCart Unified Method.

Source

import { getCartId, defineApi } from "@vsf-enterprise/unified-api-sapcc";
import { getCart } from "../getCart";

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

  await context.api.removeVoucherFromCart({
    cartId,
    voucherId: args.couponId,
  });
  return getCart(context);
});