Spaces:
Sleeping
Sleeping
Update templates/cart.html
Browse files- templates/cart.html +8 -8
templates/cart.html
CHANGED
@@ -269,16 +269,16 @@
|
|
269 |
|
270 |
// If checkbox is selected
|
271 |
if (couponCheckbox.checked) {
|
272 |
-
let selectedCoupon = couponDropdown.value;
|
273 |
-
|
274 |
-
|
275 |
-
if (!selectedCoupon) {
|
276 |
-
alert("Please select a coupon to apply.");
|
277 |
document.getElementById("discountText").innerText = `Discount: $0`;
|
278 |
document.getElementById("totalBillText").innerText = `Total Bill: $${subtotal.toFixed(2)}`;
|
279 |
return;
|
280 |
}
|
281 |
|
|
|
|
|
282 |
// Apply 10% discount
|
283 |
let discount = subtotal * 0.10;
|
284 |
let total = subtotal - discount;
|
@@ -297,10 +297,10 @@
|
|
297 |
function proceedToOrder() {
|
298 |
let couponCheckbox = document.getElementById('couponCheckbox');
|
299 |
let couponDropdown = document.getElementById('couponDropdown');
|
300 |
-
let selectedCoupon = couponCheckbox.checked ? couponDropdown.value : "";
|
301 |
|
302 |
-
if (couponCheckbox.checked && !selectedCoupon) {
|
303 |
-
alert("Please select a coupon before proceeding.");
|
304 |
return;
|
305 |
}
|
306 |
|
|
|
269 |
|
270 |
// If checkbox is selected
|
271 |
if (couponCheckbox.checked) {
|
272 |
+
let selectedCoupon = couponDropdown.value.trim();
|
273 |
+
if (!selectedCoupon || selectedCoupon.toLowerCase() === "none") {
|
274 |
+
alert("Please select a valid coupon.");
|
|
|
|
|
275 |
document.getElementById("discountText").innerText = `Discount: $0`;
|
276 |
document.getElementById("totalBillText").innerText = `Total Bill: $${subtotal.toFixed(2)}`;
|
277 |
return;
|
278 |
}
|
279 |
|
280 |
+
|
281 |
+
|
282 |
// Apply 10% discount
|
283 |
let discount = subtotal * 0.10;
|
284 |
let total = subtotal - discount;
|
|
|
297 |
function proceedToOrder() {
|
298 |
let couponCheckbox = document.getElementById('couponCheckbox');
|
299 |
let couponDropdown = document.getElementById('couponDropdown');
|
300 |
+
let selectedCoupon = couponCheckbox.checked ? couponDropdown.value.trim() : "";
|
301 |
|
302 |
+
if (couponCheckbox.checked && (!selectedCoupon || selectedCoupon.toLowerCase() === "none")) {
|
303 |
+
alert("Please select a valid coupon before proceeding.");
|
304 |
return;
|
305 |
}
|
306 |
|