Vue Storefront is now Alokai! Learn More
RemoveCartLineItem

RemoveCartLineItem

Implements RemoveCartLineItem Unified Method.

Source

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

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


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

  const cart = await context.api.removeProductFromBasket({
    basketId: cartId,
    itemId: lineItemId,
  });

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