From 63d4785483c593fe3a0a520f769201452d579cd6 Mon Sep 17 00:00:00 2001 From: mike Date: Sun, 31 Aug 2025 23:21:12 -0500 Subject: [PATCH] feat: enhance cart and checkout components to display variant attribute values --- src/routes/account/orders/index.tsx | 4 +++- src/routes/cart/index.tsx | 11 ++++++----- src/routes/category/index.tsx | 1 - src/routes/checkout/index.tsx | 6 +++--- src/services/cart.service.ts | 2 -- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/routes/account/orders/index.tsx b/src/routes/account/orders/index.tsx index dccd7c0..20f1ab7 100644 --- a/src/routes/account/orders/index.tsx +++ b/src/routes/account/orders/index.tsx @@ -13,6 +13,8 @@ export async function loader({ request }: Route.LoaderArgs) { try { const orders = await getOrdersByUser(request); + console.log("ORDERS", orders[0].items); + orders.sort((a, b) => b.createdAt.getTime() - a.createdAt.getTime()); return { orders }; @@ -29,7 +31,7 @@ export default function Orders({ loaderData }: Route.ComponentProps) { {orders!.length > 0 ? (
{orders!.map((order) => ( -
+
diff --git a/src/routes/cart/index.tsx b/src/routes/cart/index.tsx index e80a88b..db8b1ee 100644 --- a/src/routes/cart/index.tsx +++ b/src/routes/cart/index.tsx @@ -30,8 +30,9 @@ export default function Cart({ loaderData }: Route.ComponentProps) { Carrito de compras
- {cart?.items?.map(({ product, quantity, id, attributeValueId }) => ( -
+ {cart?.items?.map(({ product, quantity, id, variantAttributeValue + }) => ( +
-

{product.title}

+

{product.title} ({variantAttributeValue?.value})

diff --git a/src/routes/category/index.tsx b/src/routes/category/index.tsx index 5066e1a..a25f856 100644 --- a/src/routes/category/index.tsx +++ b/src/routes/category/index.tsx @@ -28,7 +28,6 @@ export async function loader({ params, request }: Route.LoaderArgs) { const [category] = await Promise.all([ getCategoryBySlug(categorySlug), ]); - console.log({categorySlug, minValue, maxValue}) const finalProducts = await filterByMinMaxPrice(categorySlug, minValue, maxValue); return { diff --git a/src/routes/checkout/index.tsx b/src/routes/checkout/index.tsx index 8b23f33..27c4a3e 100644 --- a/src/routes/checkout/index.tsx +++ b/src/routes/checkout/index.tsx @@ -249,9 +249,9 @@ export default function Checkout({

Resumen de la orden

- {cart?.items?.map(({ product, quantity }) => ( + {cart?.items?.map(({ product, quantity, variantAttributeValue }) => (
@@ -262,7 +262,7 @@ export default function Checkout({ />
-

{product.title}

+

{product.title} ({variantAttributeValue?.value})

{quantity}

diff --git a/src/services/cart.service.ts b/src/services/cart.service.ts index a63a665..417bcbb 100644 --- a/src/services/cart.service.ts +++ b/src/services/cart.service.ts @@ -45,8 +45,6 @@ async function getCart( }, }); - console.log("DATA CART SERVICE", data?.items); - if (!data) return null; return {