I can't seem to reproduce this on a clean install, but it is happening on my development site. I have only enabled the coupon module and have not created and coupons/discounts. When a user clicks "continue to next step" to review their order, it actually submits the coupon form. If no coupon is added in the coupon field, then a user receives a message "Please enter a code."

See attached screenshot:

screenshot

Comments

pixelsweatshop’s picture

Issue summary: View changes
dpolant’s picture

Status: Active » Closed (fixed)

This has been fixed since this issue has been opened, try latest dev.

HarlsHicks’s picture

I'm not sure it's been fixed. I'm experiencing the same issue on clean install of Coupon 7.x-2.0-beta4+3-dev.

I'm not really sure what else to report. Any ideas as to what causes it in the first place?

HarlsHicks’s picture

Status: Closed (fixed) » Active

Still experiencing this issue on the latest dev on fresh install.

pixelsweatshop’s picture

Title: "Continue to next step" submit the "Add Coupon" form » The "Continue to next step" in Commerce checkout also submits the "Add Coupon" form
HarlsHicks’s picture

Just an update on my environment. I'm running the Commerce Order Types module. I have a regular checkout and a "Wholesale" checkout.

I don't experience this bug with our regular checkout. I only experience the issue with the "Wholesale" checkout.

After some poking around, I figured out that this is getting triggered at line 89 in commerce_coupon.checkout_pane.inc. I'm going to research why it's falsely triggering the "Add Coupon" button, but unfortunately I'm still a novice when it comes to PHP.

sangus’s picture

This was happening for me on a site that had the UPS shipping module enabled. Whenever the address verification window would pop-up, and you'd click the button to either accept their suggested address or bypass their suggestion, it would cause this problem. It's a bit of a workaround, but I used the "Commerce Checkout Pages" module to create a page ONLY for coupons. This just bypasses the problem altogether. I know it's not the best solution, but I hope it helps someone else.

BD3’s picture

For me, I had some custom jQuery that was causing this. Removed all of my custom JS and it worked. Just incase anyone else is trying to trouble shoot.

dpolant’s picture

@HarlsHicks just getting back into this queue after a big client project ..

Glad you found a workaround but I'd like to figure out why it was doing this. Did you have any jQuery on the page that might have been submitting that "add coupon" button without you actually clicking it? Otherwise I can't really see how that message would be getting triggered because

$form_state['triggering_element']['#name'] == 'coupon_add'

.. is gating entry to the part of the code that thinks about setting that error.

HarlsHicks’s picture

@dpolant,

BD3 and I work together, so we resolved the issue together.

It's been long enough now that I'm not quite sure exactly what the jQuery was. It was remnants of another programmer who was trying to do some text replacements on some of the buttons on the checkout pages. What was weird though was that I was able to reproduce the same error (using his snippet), on the Cart page, where Coupon wasn't on the page at all.

I'm not sure how, but for some reason his code was actually replacing button functions. So when it would replace the text on the button (didn't matter what the text was), the button's function would change to be the next button up in the HTML.

Not sure if any of this info will even help, so scrap it if need be, but hopefully it'll give a hint to someone.

dpolant’s picture

Status: Active » Closed (fixed)
rajeevgole’s picture

I am facing the same issue in 7.x-2.0-rc3 branch. I have tried in fresh install but no luck.