Skip to content

Commit 4a90be8

Browse files
committed
ACP2E-3646: Addresses selection is not saved when we "Check Out with Multiple Addresses"
1 parent ca6ca43 commit 4a90be8

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

app/code/Magento/Multishipping/Model/Cart/MultishippingClearItemAddress.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2025 Adobe
4+
* All Rights Reserved.
55
*/
66
declare(strict_types=1);
77

@@ -74,6 +74,7 @@ public function __construct(
7474
/**
7575
* Cleans shipping addresses and item assignments after MultiShipping flow
7676
*
77+
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
7778
* @param Cart|UpdateItemQty $subject
7879
* @param RequestInterface $request
7980
* @throws LocalizedException
@@ -95,7 +96,6 @@ public function clearAddressItem($subject, $request)
9596
}
9697

9798
if ($currentShippingAddress) {
98-
$defaultShipping = $currentShippingAddress->getCustomerAddressId();
9999
$quote->addShippingAddress($currentShippingAddress);
100100
} else {
101101
$shippingAddress = $quote->getShippingAddress();

app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2025 Adobe
4+
* All Rights Reserved.
55
*/
66

77
namespace Magento\Multishipping\Model\Checkout\Type;
@@ -277,6 +277,8 @@ public function __construct(
277277
*
278278
* @return \Magento\Multishipping\Model\Checkout\Type\Multishipping
279279
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
280+
* @SuppressWarnings(PHPMD.NPathComplexity)
281+
* @throws LocalizedException
280282
*/
281283
protected function _init()
282284
{
@@ -295,6 +297,7 @@ protected function _init()
295297
* Remove all addresses
296298
*/
297299
$addresses = $quote->getAllAddresses();
300+
$defaultShippingId = null;
298301
foreach ($addresses as $address) {
299302
if ($address->getAllItems()) {
300303
$defaultShippingId = $address->getCustomerAddressId();

app/code/Magento/Multishipping/Test/Unit/Model/Cart/MultishippingClearItemAddressTest.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ public function testClearAddressItem(
9494
'getAllShippingAddresses',
9595
'removeAddress',
9696
'getShippingAddress',
97-
'getCustomer'
97+
'getCustomer',
98+
'addShippingAddress'
9899
]);
99100
$requestMock->method('getActionName')
100101
->willReturn($actionName);
@@ -119,6 +120,9 @@ public function testClearAddressItem(
119120
$customerMock = $this->getMockForAbstractClass(CustomerInterface::class);
120121
$quoteMock->method('getCustomer')
121122
->willReturn($customerMock);
123+
$quoteMock->method('addShippingAddress')
124+
->with($shippingAddressMock)
125+
->willReturnSelf();
122126
$customerMock->method('getDefaultShipping')
123127
->willReturn($customerAddressId);
124128

0 commit comments

Comments
 (0)