Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempting to complete an order by payment returns error and clears out shipping method & addresses #85

Open
michaelrog opened this issue Jan 25, 2022 · 14 comments

Comments

@michaelrog
Copy link
Contributor

Everything works as expected on the front-end... but when we attempt to complete an order by payment in the admin CP, we run into a weird glitch: The request comes back with an error from Commerce:

Something changed with the order before payment

Notably, the previously-saved shipping method and shipping/billing addresses are then cleared out.

Have yall seen anything like this before?

Additional info

  • Postie 2.4.13
  • Craft 3.7.28 (multi-site)
  • Commerce 3.4.10.1
@engram-design
Copy link
Member

Looks like I can replicate this event earlier in the process, when creating and order in the control panel although I can't quite nail down what's causing it. But something is stripping the shipping address from the order, causing Postie to log:

2022-01-26 00:09:48 [-][1][-][info][postie] Post: No shipping address for order.
2022-01-26 00:09:48 [-][1][-][info][postie] Post: No shipping address for order.
2022-01-26 00:09:48 [-][1][-][info][postie] Post: No shipping address for order.
2022-01-26 00:09:48 [-][1][-][info][postie] Post: No shipping address for order.
2022-01-26 00:09:48 [-][1][-][info][postie] Post: No shipping address for order.
2022-01-26 00:09:48 [-][1][-][info][postie] Post: No shipping address for order.

Multiple times, as you can see. I can replicate this by creating an order in the control panel, and selecting an Postie-provided shipping method, and saving the order. That seems to work all fine, but then selecting another shipping method (also from Postie), and then hitting save again defaults back to a Commerce-based shipping method ("Free Shipping" in my case), due to the above multiple order update call.

I'll have to do some more investigating here, but I'd assume that this is the same issue as when getting to payment. To be clear, is this an order that's been completed? That does have some bearing on how we handle things.

@michaelrog
Copy link
Contributor Author

No, the order hasn't yet been completed. It's being completed, by way of a Payment, when we encounter the error.

@engram-design
Copy link
Member

Yep, just thought to check as you can technically have a completed, unpaid order. What I mean is, is there a "Mark as Complete" button in the control panel when editing the order?

@michaelrog
Copy link
Contributor Author

michaelrog commented Jan 27, 2022

...as you can technically have a completed, unpaid order. What I mean is, is there a "Mark as Complete" button in the control panel when editing the order?

Yes, I am dealing with an incomplete unpaid order — i.e. completed is false and the control panel UI includes a "Mark as Completed" button.

@jakedohm
Copy link

@engram-design hi Josh! This issue is from something Michael is working with our team at Steadfast on. I wanted to follow up to see if you had made any progress on this, or if you needed any more data from us to dig into this?

@engram-design
Copy link
Member

@jakedohm Haven't had oodles of time to jump into this, but I was chatting with the Commerce team about it, and what's supposed to be happening, without much headway. I'll take another stab at it soon.

@engram-design
Copy link
Member

I've made some improvements in 5a16e35 that should have some benefit here. In my testing, this doesn't seems to be happening anymore, but worth confirming on your end?

@michaelrog
Copy link
Contributor Author

michaelrog commented Mar 22, 2022

Unfortunately, even roping in 5a16e35 via craft-3-dev, this issue persists in our setup:

When completing an order via Transaction in the CP, we see a payment error:

There are errors on the order

  • The total price of the order changed.
  • The total number of order adjustments changed.

Additionally, we see a new Customer Notice registered:

Customer Notices

  • The previously-selected shipping method is no longer available.

Finally — and most destructively — the Shipping Address, Billing Address, and Shipping Method are all cleared out.

(To confirm, this order has been updated/saved to commit any extant changes, before attempting to complete the order with via a payment Transaction. Prior to attempting payment, the order does show its Postie-provided shipping method and cost.)

(Craft CMS 3.7.37, Commerce 3.4.12)

@engram-design
Copy link
Member

So I really can't replicate this on my end, and I've tried all sorts of different gateways, updating orders and different stages.

Is there anything on your end that might modify the order on its complete event, payment event, or otherwise?

Would it be too much to ask for a video of the issue, just in case I'm doing something different to you? Here's a recording of me going through the process. https://d.pr/v/vHHyiG

@RitterKnightCreative
Copy link

Having the same issue here on Commerce 4.x.

I noticed if you start in the CP, like in your recording Josh @engram-design, I don't have any issues.

However, if you start an order on the front end, fill up your cart, pick a shipping method, once you hit the back end to complete it, it breaks.

I'll get to the point on the front end where I'm going to take payment, I'll hop back to the control panel, jump into Active Carts, and then try to mark as complete from there (for example, for testing purposes).

Seems Commerce doesn't want to play ball at this point.

FWIW I'm using UPS plugin and PayPal gateway.

Not sure if that helps...

@engram-design
Copy link
Member

Is it the same error, or something else? And it still clears out the shipping method and addresses?

@RitterKnightCreative
Copy link

Had a chance to do a little more digging. I think this might be more of Commerce bug than Postie. Client has a multisite with products in both. If I try completing the order on the primary site, everything works just fine. However, if I try to complete it on the secondary site, the whole order gets nulled. It's almost like Commerce is only using the primary site on the CP and when the products on the secondary site don't "exist", everything goes haywire.

@engram-design
Copy link
Member

Ah, now that's good to know. I wonder if that might be different with multi-store in Commerce 5? I'll play around with it.

@RitterKnightCreative
Copy link

Yeh I was wondering the same thing about 5... hopefully they've made some improvements with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants