Bug; Coupon Code functionality broken when adding a coupon if disallowed and then allowed

Create two coupons that are not combinable. Add Coupon 1. Add Coupon 2. Coupon 2 is correctly disallowed. Remove coupon 1. Coupon 2 should now be allowed, but it is not - in fact the button appears to the customer to be broken, as it produces no behavior.

My guess here is that the foxycart code has stored the recently disallowed coupon and selects to not re-submit the coupon for rule checking. You need to submit the coupon code for rule checking every time a code is entered, in case cart conditions have changed, even if it is the same code that was most recently entered.

There is another related issue that isn't a showstopper like the above, but that you should fix while you are in there. Once a coupon code is evaluated, whether it is then added to the cart or disallowed, you should clear the coupon code textbox, even though it is hidden. It's strange behavior when the customer goes to add a second coupon (if the first was applied) or to try a different coupon (if the first was disallowed) to find the coupon box filled with the prior-entered coupon code.
  • fc_adamfc_adam FoxyCart Team

    Thanks for including the steps to reproduce the issue. I was able to reproduce it - and it does look to relate to the coupon-add failing. The button stops working, but you can still submit the coupon code by pressing enter when the text area is focused. I'll create a ticket on our side to get that button fixed.

    In terms of your suggestion for clearing the coupon field - we do clear it when a coupon is successfully added. We don't clear it on error though, to allow the customer to check what they entered and alter it to fix a possible spelling issue.
Sign In or Register to comment.