Error on shipment save after removing a order item

Created on 14 June 2019, almost 6 years ago
Updated 2 January 2024, over 1 year ago

Problem

If one removes a item from a order and then goes to the shipment and tries to save, an error is thrown:
Error: Call to a member function getQuantity() on null in Drupal\commerce_shipping\Form\ShipmentForm->addShippingItems() (line 302 of modules/contrib/commerce_shipping/src/Form/ShipmentForm.php).

Solution

Add an if equals null continue.

Keep in mind

This is just symptom of another issue. The real problem occurs al ready on the order save, after which the data is in an inconsistent state. The order saying that the article has been removed but the shipment still wanting to ship the item.
Maybe something similar to the related issue, which proposes an event subscriber, for when the order items are being changed to recalculate the shipping items as well.

🐛 Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

🇨🇭Switzerland Siegrist

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

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024