Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -1039,7 +1039,8 @@ def checkout():
1039
  try:
1040
  # Fetch the selected coupon (if any)
1041
  data = request.json
1042
- selected_coupon = data.get("selectedCoupon", "").strip() # Get selected coupon
 
1043
  print(f"Selected Coupon: {selected_coupon}") # Debugging selected coupon
1044
 
1045
  # Fetch cart items for the current user
 
1039
  try:
1040
  # Fetch the selected coupon (if any)
1041
  data = request.json
1042
+ selected_coupon = data.get("selectedCoupon", "").strip() if data.get("selectedCoupon") else None
1043
+ # Now selected_coupon will be None if it's not provided or empty, or a valid string otherwise
1044
  print(f"Selected Coupon: {selected_coupon}") # Debugging selected coupon
1045
 
1046
  # Fetch cart items for the current user