As of Commerce 2.11, orders get automatically placed, as soon as they are paid in full: #2934647: The order can stay unplaced after an offsite payment

After updating to 2.11, we had the same problems with all PayPal orders (express checkout):

  • The "place" event gets fired twice
  • The "total_paid" value of the order is empty

This clearly looked as a typical double-save problem. And so it is: The onReturn() callback sets data on the order and saves the order afterwards. This save call causes the problems.

I've had a closer look and saw that saving isn't necessary at all. Setting the data on the order is enough, it will be saved by Commerce anyway. I'll add a patch here and also talk with @bojanz to clarify the interface api comment more if necessary

CommentFileSizeAuthor
#2 3011660-2.patch1.01 KBagoradesign

Comments

agoradesign created an issue. See original summary.

agoradesign’s picture

Status: Active » Needs review
StatusFileSize
new1.01 KB
agoradesign’s picture

Assigned: agoradesign » Unassigned
bojanz’s picture

It's odd that the paid event gets fired twice, we have protection against that (in OrderStorage), how is it bypassed?

TheWinkingSkeever’s picture

THANK YOU!!

I was getting duplicate receipt emailed out whenever using the express checkout. Commenting out that //$order->save(); solved my issue. Everything else appears to be working fine as well.

  • bojanz committed 0ed566d on 8.x-1.x authored by agoradesign
    Issue #3011660 by agoradesign: Place event of orders get fired twice on...
bojanz’s picture

Status: Needs review » Fixed

Committed the #2 patch with a comment tweak. Even with the Commerce bug fixed, we shouldn't be saving the order here.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.