mirror of
https://github.com/vercel/commerce.git
synced 2025-05-18 23:46:58 +00:00
17 lines
464 B
TypeScript
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} />;
|
|
}
|