Stop unsetting the order ID reference from the order refresh

Created on 25 January 2024, 8 months ago
Updated 14 August 2024, about 1 month ago

Describe your bug or feature request.

The following line of code has always been bothering me and I'm not entirely sure why it's there:

          // Remove the order that was set above, to avoid
          // crashes during the entity save process.
          $order_item->order_id->entity = NULL;

This was added a long time ago (See #2873394: Make taxes functional ). While doing some profiling with Blackfire, I found this line being responsible for a double order item save.
On add to cart via JSONAPI, the order_id field is set on the order item, and it's then unset by the OrderRefresh causing an unnecessary extra save.

Let's see what happens with the tests after removing this line.

📌 Task
Status

Needs review

Version

2.0

Component

Order

Created by

🇮🇱Israel jsacksick

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024