diff --git a/app/code/Magento/Sales/Model/Order/Invoice/Plugin/AddressUpdate.php b/app/code/Magento/Sales/Model/Order/Invoice/Plugin/AddressUpdate.php index 9efa4258763e08d4e1833a6ab1108b1f1074b0a2..9fe280f5521e5ebca2fadb638abc5fb09d23fefe 100644 --- a/app/code/Magento/Sales/Model/Order/Invoice/Plugin/AddressUpdate.php +++ b/app/code/Magento/Sales/Model/Order/Invoice/Plugin/AddressUpdate.php @@ -33,6 +33,7 @@ class AddressUpdate /** * @param \Magento\Sales\Model\ResourceModel\Order\Handler\Address $subject + * @param \Magento\Sales\Model\ResourceModel\Order\Handler\Address $result * @param \Magento\Sales\Model\Order $order * @return void * @SuppressWarnings(PHPMD.UnusedFormalParameter) @@ -51,13 +52,13 @@ class AddressUpdate foreach ($order->getInvoiceCollection()->getItems() as $invoice) { $invoiceAttributesForSave = []; - if (!$invoice->getBillingAddressId()) { + if (!$invoice->getBillingAddressId() && $billingAddress) { $invoice->setBillingAddressId($billingAddress->getId()); $invoiceAttributesForSave[] = 'billing_address_id'; $orderInvoiceHasChanges = true; } - if (!$invoice->getShippingAddressId()) { + if (!$invoice->getShippingAddressId() && $shippingAddress) { $invoice->setShippingAddressId($shippingAddress->getId()); $invoiceAttributesForSave[] = 'shipping_address_id'; $orderInvoiceHasChanges = true;