The method hasItems in Order entity does not guarantee that order items are missing.

Steps to reproduce:

  1. Create the new Order with a one items
  2. Remove order item entity without removing it on order_items field in Order (I faced with this case sometimes, I couldn't find and fix it)
  3. The OrderRefresh will run all processors

I suggest to add the additional condition to prevent such cases

Comments

unrealauk created an issue. See original summary.

unrealauk’s picture

Component: Promotions » Order
unrealauk’s picture

Version: 8.x-2.24 » 8.x-2.17
unrealauk’s picture

Status: Active » Needs review
StatusFileSize
new822 bytes

Please, review my patch.

unrealauk’s picture

Assigned: unrealauk » Unassigned
jsacksick’s picture

Status: Needs review » Needs work

Then we need to remove the $order->hasItems() that is done right before if it's not working as expected, and replacing it by that.

Also, we're calling $order->hasItems() again later in the code.

reflie’s picture

Version: 8.x-2.17 » 8.x-2.x-dev
Status: Needs work » Needs review
StatusFileSize
new495 bytes

Hi @jsacksick. Seems that it will be enough to replace !$order->hasItems() condition with !$order->getItems() one.

Take a look at the attached patch.

Thanks

  • jsacksick committed f08d043 on 8.x-2.x authored by reflie
    Issue #3202997 by unrealauk, reflie: Order refresh still works with...
jsacksick’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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