I'm using commerce_shipping, and my coupon form is on the same checkout pane as my shipping selector. Previously this seemed to work fine, but some recent update has caused an incompatibility.

Basically, if I enter a coupon code and hit the 'add coupon' button, the coupon is added to the order properly, but when I click the submit button to move on to the next pane, a validation error is thrown from the shipping module that says:

No valid shipping rates found for your order, and we require shipping service selection to complete checkout.

Even though I do have a shipping method selected. If I simply submit the form again, it goes through as expected. If I have more than one shipping method and I choose another method other than the default selected item, I can also progress to the next screen. So, basically, if I leave the shipping form as is, with the default option selected, and add a coupon, I cannot progress.

Unfortunately, I can't figure out if this is a validation issue with commerce_shipping, or an incorrect processing of the ajax functionality of commerce_coupon. If I do not add a coupon to the order, I can just hit the submit button and I can progress to the next screen and the shipping item is selected properly from the pre-selected default option.

Comments

rollingnet’s picture

I'm facing the same problem: it works everything well until I'm using coupon feature.
This issue is introduced in latest dev version of shipping or coupon module update.
I will investigate more on this issue.
This a blocking one for everyone that use coupon feature.

rollingnet’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev
Category: Support request » Bug report
dpolant’s picture

What version of shipping are you guys using? Also, are you using the profile copy functionality for copying billing to shipping or vise versa?

dpolant’s picture

Dug into this a bit. Try reverting to this commit of commerce shipping and let me know if that fixes it:

git checkout 2fb78743ce93d1f1381c8f83c238c59a6efa7168

That is the commit right before 76e2a50ceb5a9cb2f345fc165ea9193a18c39a84 "Issue #2026321 by tatyana, andyg5000, plach: Fixed Avoid overwriting an already updated order"

I think ^ might be the offending commit. It has some code that basically throws up if another module has saved the order.

It's getting to the point where almost all instability found in Coupons/discounts and other checkout modules can be traced back to issues like this where different modules are saving the order without a good central pattern for taking other's changes into account.

I will see if there is something to be done in Coupon or Discount module that can mitigate this.

dpolant’s picture

OK I reopened the Commerce Shipping issue that generated what I am pretty sure is the offending patch: https://www.drupal.org/node/2026321

As it turns out, this issue relates to incompatibility between discounts and shipping (not coupons and shipping).

rooby’s picture

I am also seeing this and it seems to be a direct result of that other issue commit.

To help others find this, this is the error message you get if you're using a newer version of the shipping module:

You are not authorized to access this command.

schoash’s picture

The message robby mentioned is also thrown, if the city field is not correctly set in the form. At least I am getting this error, when the shipping calculation is done with ajax.

anybody’s picture

I can confirm this problem still exists. Any solutions or quickfixes?

torgospizza’s picture

@Anybody: I'm fairly certain the issue here is the same as in #2026321: Avoid overwriting an already updated order. The error you're seeing was caused by one of the commits from that issue. Use the most recent patch to remove that code, and then apply the other patch at #1804592: During AJAX form submission in checkout, the $order argument passed by the Form API is incorrect.. The combination of those two patches should solve the issue.

anybody’s picture

I can completely confirm #9! These two patches solved my issue. I'll review these patches and post my feedback there!
We should commit them as soon as possible and well tested.

a.milkovsky’s picture

The issue #2026321: Avoid overwriting an already updated order is now committed. It was enough for me to just update commerce_shipping to the latest dev version. Should we close the issue?

anybody’s picture

I think we should wait for some further replies that this issue is also fixed by the related fix. It's not that simple to reproduce but an important problem. If the replies are positive, lets close this afterwards. :)

swickham’s picture

I'm working on a site right now that showed this error once we moved the shipping quotes to the main checkout page. We had Commerce Shipping 7.x-2.2 installed and have replaced it with the latest dev version, I can confirm the problem went away for us after that. There was no need to apply the second patch mentioned in #9.

swickham’s picture

Status: Active » Reviewed & tested by the community

Forgot to change the issue status.

a.milkovsky’s picture

mglaman’s picture

To confirm: We need a new Shipping release to resolve this bug. No patches, no documentation.

Collins405’s picture

Yep, we upgraded to the latest dev version of Commerce Shipping and problem solved.