nagasurendra commited on
Commit
af39efe
·
verified ·
1 Parent(s): 2a3c249

Update templates/cart.html

Browse files
Files changed (1) hide show
  1. templates/cart.html +9 -2
templates/cart.html CHANGED
@@ -571,10 +571,18 @@
571
 
572
  function proceedToOrder() {
573
  let couponDropdown = document.getElementById('couponDropdown');
 
 
 
 
 
 
 
 
574
  let selectedCoupon = couponDropdown.value.trim(); // Get selected coupon from the dropdown
575
 
576
  // If no coupon is selected, alert the user
577
- if (selectedCoupon === "None" || selectedCoupon === "Null") {
578
  alert("Please select a valid coupon before proceeding.");
579
  return;
580
  }
@@ -597,7 +605,6 @@
597
  .catch(err => console.error('Error during checkout:', err));
598
  }
599
 
600
-
601
  function calculateSubtotal() {
602
  let subtotal = 0;
603
  document.querySelectorAll('.cart-item').forEach(item => {
 
571
 
572
  function proceedToOrder() {
573
  let couponDropdown = document.getElementById('couponDropdown');
574
+
575
+ // Check if the coupon dropdown exists and is visible
576
+ if (!couponDropdown) {
577
+ console.log("Coupon dropdown does not exist.");
578
+ alert("No coupons available.");
579
+ return;
580
+ }
581
+
582
  let selectedCoupon = couponDropdown.value.trim(); // Get selected coupon from the dropdown
583
 
584
  // If no coupon is selected, alert the user
585
+ if (selectedCoupon === "" || selectedCoupon === "None" || selectedCoupon === "Null") {
586
  alert("Please select a valid coupon before proceeding.");
587
  return;
588
  }
 
605
  .catch(err => console.error('Error during checkout:', err));
606
  }
607
 
 
608
  function calculateSubtotal() {
609
  let subtotal = 0;
610
  document.querySelectorAll('.cart-item').forEach(item => {