RemoveCouponFromCart
Implements RemoveCouponFromCart
Unified Method.
Source
import { getCartId, defineApi } from "@vsf-enterprise/unified-api-sapcc";
import { methods } from "@vsf-enterprise/unified-api-sapcc";
const { getCart } = methods;
import from "@vsf-enterprise/unified-api-sapcc/udl";
declare module "@vsf-enterprise/unified-api-sapcc" {
interface RemoveCouponFromCartExtendedArgs {}
}
export const removeCouponFromCart = defineApi.removeCouponFromCart(async (context, args) => {
const cartId = args.cartId ?? getCartId(context);
await context.api.removeCartVoucher({
cartId,
voucherId: args.couponId,
});
return getCart(context);
});