Skip to content

Commit 0194d4b

Browse files
author
Stanislav Idolov
committed
MAGETWO-58136: [Github] Shipping and billing address are not set if order placed with payment action Sale #6438
1 parent 7dc1d7a commit 0194d4b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

app/code/Magento/Sales/Model/Order/Invoice/Plugin/AddressUpdate.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public function __construct(
3333

3434
/**
3535
* @param \Magento\Sales\Model\ResourceModel\Order\Handler\Address $subject
36+
* @param \Magento\Sales\Model\ResourceModel\Order\Handler\Address $result
3637
* @param \Magento\Sales\Model\Order $order
3738
* @return void
3839
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
@@ -51,13 +52,13 @@ public function afterProcess(
5152
foreach ($order->getInvoiceCollection()->getItems() as $invoice) {
5253
$invoiceAttributesForSave = [];
5354

54-
if (!$invoice->getBillingAddressId()) {
55+
if (!$invoice->getBillingAddressId() && $billingAddress) {
5556
$invoice->setBillingAddressId($billingAddress->getId());
5657
$invoiceAttributesForSave[] = 'billing_address_id';
5758
$orderInvoiceHasChanges = true;
5859
}
5960

60-
if (!$invoice->getShippingAddressId()) {
61+
if (!$invoice->getShippingAddressId() && $shippingAddress) {
6162
$invoice->setShippingAddressId($shippingAddress->getId());
6263
$invoiceAttributesForSave[] = 'shipping_address_id';
6364
$orderInvoiceHasChanges = true;

0 commit comments

Comments
 (0)