1
0
mirror of https://github.com/vercel/commerce.git synced 2025-08-12 20:01:23 +00:00
Files
commerce/components/cart/index.tsx
2024-03-27 19:34:16 +07:00

17 lines
464 B
TypeScript

import { getCart } from 'lib/shopify';
import { cookies } from 'next/headers';
import { calculateDiscounts } from './actions';
import CartModal from './modal';
export default async function Cart() {
const cartId = cookies().get('cartId')?.value;
let cart;
let tieredDiscounts;
if (cartId) {
cart = await getCart(cartId);
tieredDiscounts = await calculateDiscounts(cart);
}
return <CartModal cart={cart} tieredDiscount={tieredDiscounts} />;
}