I have a Commerce e-store configured and running using commerce_coupon and commerce_tax (among other modules).
I've been asked to replace commerce_tax with commerce_avatax: https://drupal.org/project/commerce_avatax
This seems to work as expected, except it is causing the Coupon field on the Checkout form to become Required when it was previously Optional. More specifically it does not appear to be Required (no asterisk to indicate this), but leaving the field blank and attempting to complete the checkout process results in the message "Your coupon code is not valid." and I cannot continue. This appears to be the message generated on Line 84 of commerce_coupon/includes/commerce_coupon.checkout_pane.inc but I am unsure why the conditions leading to it would be different now than they were previously.
There were Rules used to calculate tax which were automatically disabled when I disabled commerce_tax in favour of commerce_avatax. Could this be causing commerce_coupon to check for something which should be empty but is now set?
Any help greatly appreciated.
Comments
Comment #2
chered commentedI am also encountering on commerce braintree payment module. I have two payment system, paypal and braintree. Paypal seems ok.
The error is also "Your coupon code is not valid.".
Comment #3
pk69 commentedSimilar situation occurs to me when I cannot found some strings for translating via UI and I changed value of INPUT element (i.e. label of button) directly via jQuery (very bad idea).
This action broken "triggering element" mechanism and generate described error.
So, check if you or any other installed module doesn't modify the value of INPUT element incorrect way.
Comment #4
johnpicozziI am having the same issue with the AvaTax & Coupon Modules. Anyone come up with a solution?
Comment #5
replicaobscuraI spawned a more generic module from commerce_avatax in my sandbox named commerce_tax_services, and my module experienced the exact same conflict with commerce_coupon. I discovered it's related to the address validation that commerce_avatax does.
Normally, it modifies the checkout form in order to make the default submit button fire off address validation first (I think, I haven't had time to dig very deep yet). I have a feeling that when commerce_coupon is enabled, commerce_avatax (and potentially other modules such as mine) are for some reason making the default submit button actually submit using the coupon submit button.
If you dpm() the $form_state within the commerce_coupon_pane_checkout_form() you can see it actually sees the coupon add button as the trigger element, even though you clicked the main Submit button.
In my custom module, I have the option to simply turn off address validation, which makes it not modify the checkout form at all, and works around the problem successfully. However, more work will be needed to make commerce_avatax's address validation and commerce_coupon work together.
Comment #6
bpirkle commentedI posted about a similar issue involving both Commerce Avatax and Commerce Coupon here, in case it helps anyone:
https://www.drupal.org/project/commerce_coupon/issues/28816201
My workaround was to move the Coupon pane to the second page of checkout, so I never came up with an actual resolution.