"use client"; import { useCart, useCartForm } from "@/lib/cart"; import { content } from "@/lib/content"; import { formatPrice } from "@/lib/money"; import { CartLineItem } from "./CartLineItem"; /** * Shared cart content — line items, discount code form, and totals. Used by * both the cart drawer and the `/cart` page (`hydrogen-cart-ui` / * `hydrogen-cart-drawer`). The drawer wraps this in fixed header/body/footer * zones; the page wraps it in a page layout. * * Layout: the line-item list flexes to fill the available height and scrolls on * its own; the discount code + estimated-total block is pinned to the bottom * (feedback: bottom-align the footer block). The order note was removed — its * "save note" button was non-functional and the entry point is gone. */ export function CartContent() { const cart = useCart((state) => state.data); const loading = useCart((state) => state.loading); const lines = cart.lines.nodes; const totalQuantity = cart.totalQuantity; const subtotal = cart.cost.subtotalAmount; const discountCodes = cart.discountCodes; const { formProps, register } = useCartForm(); if (loading) { return (
Loading cart…
{content.cart.empty}
{content.cart.emptyDescription}
{content.cart.taxesAndShippingAtCheckout}