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)