From bbb541a7a6fa4342f2dbee9160c553084e2d78ce Mon Sep 17 00:00:00 2001 From: Rhys Sullivan <39114868+RhysSullivan@users.noreply.github.com> Date: Fri, 18 Oct 2024 16:39:30 -0700 Subject: [PATCH] limit cost to 2 decimals --- src/app/order/dynamic.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/order/dynamic.tsx b/src/app/order/dynamic.tsx index 7ec90e9..f6ad631 100644 --- a/src/app/order/dynamic.tsx +++ b/src/app/order/dynamic.tsx @@ -34,6 +34,8 @@ function CartItem({ product }: { product: CartItem }) { if (!product) { return null; } + // limit to 2 decimal places + const cost = (Number(product.price) * product.quantity).toFixed(2); return (
- ${Number(product.price) * product.quantity} -
+${cost}