Vue Storefront is now Alokai! Learn More
RemoveCartLineItem

RemoveCartLineItem

Implements RemoveCartLineItem Unified Method.

Source

import "./extended";

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

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

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

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