Problem/Motivation
Currently, we have the following code for packing the order into shipments:
if (!$shipments) {
/** @var \Drupal\commerce_shipping\PackerManagerInterface $packer_manager */
// @phpstan-ignore-next-line
$packer_manager = \Drupal::service('commerce_shipping.packer_manager');
[$shipments] = $packer_manager->packToShipments($order, $this->buildCustomerProfile($order), $shipments);
}
This should call the ShippingOrderManager instead which should be conditionally injected.
Also, the buildCustomerProfile() shouldn't create a profile that has the UID set to the order customer ID as the profile belongs to the order, not the customer.
Comments
Comment #4
jsacksick commented