Problem/Motivation
After the changes that were added to the module, which allow the shipment created on the order page to be repackable, we still have an issue with repacking, as it does not take into account that the shipment can be created before any order item is added to the order. As a result, the shipment is not repacked when an order item is added/updated. Mainly, it is because of the packer plugins' sequence of execution. The first one that tries to create a ProposedShipment object is the DefaultPacker, wich dependent on the list of order items and returns an empty array. There is a condition in the PackerManager that checks if the packer does not return NULL, and it caused a problem, as the new AdminPacker is not called.
Steps to reproduce
- Create a new draft order without any items in it
- Create a new shipment with the "Add shipping information" modal form on the order view page
- Add new item(s) to the order and check the shipment
Proposed resolution
- Update the condition in PackerManager to check if the returned result by packer is not empty
- Modify the OrderItemSubscriber to recalculate shipments properly
Issue fork commerce_shipping-3566691
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
jsacksick commentedOk tests are failing on D10 due to the use of getOriginal() which was introduced in D11.
Perhaps Commerce core could introduce a helper so it can be used accross Commerce.
There are phpcs failures.
And ideally we'd add a test to confirm the following:
Comment #4
tbkot commentedA test is added to check the draft shipment creation within an empty draft order.
Comment #5
jsacksick commentedTests are failing, putting this to needs work.
Comment #7
jsacksick commented