From 8a1f44692c46b74780cf85efaf663c60a86e3e7e Mon Sep 17 00:00:00 2001 From: User Date: Sat, 15 Feb 2025 17:47:42 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B4=D0=BB=D1=8F=20=D0=BE=D0=BF=D0=BB=D0=B0?= =?UTF-8?q?=D1=82=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/style/components/checkout-form.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/frontend/style/components/checkout-form.tsx b/frontend/style/components/checkout-form.tsx index 6847aa87..8283c678 100644 --- a/frontend/style/components/checkout-form.tsx +++ b/frontend/style/components/checkout-form.tsx @@ -25,9 +25,12 @@ export function CheckoutForm() { const { items, clearCart } = useCart() const router = useRouter() + // Log the cart items to make sure they are correct + console.log("Cart items:", items) + // Define the getTotalPrice function inside the component const getTotalPrice = () => { - return items.reduce((total, item) => total + item.price * item.quantity, 0) + return items.reduce((total, item) => total + item.price * item.quantity, 0).toFixed(2) } const handleAddressSubmit = (e: React.FormEvent) => { @@ -40,7 +43,9 @@ export function CheckoutForm() { const handlePayment = async () => { setIsProcessing(true) const totalPrice = getTotalPrice() // Calculate total price here - const paymentSuccess = await processYooMoneyPayment(totalPrice) + console.log("Total Price:", totalPrice) // Log the total price to check + + const paymentSuccess = await processYooMoneyPayment(Number(totalPrice)) if (paymentSuccess) { setIsOrderPlaced(true)