Testing 1 2 3
.item, .cart, .checkout-form { margin: 20px 0; padding: 10px; border: 1px solid #ccc; } .hidden { display: none; } label { display: block; margin-top: 10px; }Item 01
Price: $10
Add to CartItem 02
Price: $20
Add to CartMake Payment via PayNow
Scan this QR code:
After payment, your order will be processed. You’ll get a confirmation email once we verify it.
${c.item} – $${c.price} x ${c.qty}
`).join(“”); document.getElementById(“cart-items”).innerHTML = list; updateTotal(); } function updateTotal() { let total = cart.reduce((sum, c) => sum + c.price * c.qty, 0); document.getElementById(“total”).innerText = “Total: $” + total.toFixed(2); } function applyPromo() { let code = document.getElementById(“promoCode”).value.trim(); if (code === “DISCOUNT10”) { cart.forEach(c => c.price *= 0.9); alert(“10% discount applied!”); updateTotal(); } else { alert(“Invalid promo code.”); } } function showCheckout() { document.getElementById(“cart”).classList.add(“hidden”); document.getElementById(“checkout”).classList.remove(“hidden”); } document.getElementById(“orderForm”).addEventListener(“submit”, function(e) { e.preventDefault(); let form = e.target; let orderSummary = cart.map(c => `${c.item} x ${c.qty} – $${(c.price * c.qty).toFixed(2)}`).join(“\n”); let total = cart.reduce((sum, c) => sum + c.price * c.qty, 0); orderSummary += `\n\nTotal: $${total.toFixed(2)}`; document.getElementById(“orderSummaryField”).value = orderSummary; emailjs.send(“YOUR_SERVICE_ID”, “YOUR_TEMPLATE_ID”, { name: form.name.value, email: form.email.value, address: form.address.value, order: orderSummary }).then(function() { alert(“Order submitted. You’ll be redirected to payment.”); document.getElementById(“checkout”).classList.add(“hidden”); document.getElementById(“paynow”).classList.remove(“hidden”); }, function(error) { alert(“Failed to send order. Try again.”); console.error(error); }); });