GetCart
Implements GetCart
Unified Method.
Source
import { defineApi, getCartFromContext } from "@vsf-enterprise/unified-api-magento";
import { getNormalizers } from "@vsf-enterprise/unified-api-magento/udl";
export const getCart = defineApi.getCart(async (context, args) => {
if (args?.cartId != null) {
throw { statusCode: 400, message: "Multiple carts feature is not available." };
}
const cart = await getCartFromContext(context);
const { normalizeCart } = getNormalizers(context);
return normalizeCart(cart);
});