Skip to content

Commit ae96f4f

Browse files
authored
ENGCOM-3503: issue #18349 Fixed for 2.3: Incorrect quote_item_id saved on order items during multiple address checkout #19192
2 parents 1a9e35c + 581ab7d commit ae96f4f

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1182,7 +1182,7 @@ private function removePlacedItemsFromQuote(array $shippingAddresses, array $pla
11821182
{
11831183
foreach ($shippingAddresses as $address) {
11841184
foreach ($address->getAllItems() as $addressItem) {
1185-
if (in_array($addressItem->getId(), $placedAddressItems)) {
1185+
if (in_array($addressItem->getQuoteItemId(), $placedAddressItems)) {
11861186
if ($addressItem->getProduct()->getIsVirtual()) {
11871187
$addressItem->isDeleted(true);
11881188
} else {
@@ -1232,7 +1232,7 @@ private function searchQuoteAddressId(OrderInterface $order, array $addresses):
12321232
$item = array_pop($items);
12331233
foreach ($addresses as $address) {
12341234
foreach ($address->getAllItems() as $addressItem) {
1235-
if ($addressItem->getId() == $item->getQuoteItemId()) {
1235+
if ($addressItem->getQuoteItemId() == $item->getQuoteItemId()) {
12361236
return (int)$address->getId();
12371237
}
12381238
}

app/code/Magento/Quote/Model/Quote/Item/ToOrderItem.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ public function __construct(
4848
}
4949

5050
/**
51+
* Convert quote item(quote address item) into order item.
52+
*
5153
* @param Item|AddressItem $item
5254
* @param array $data
5355
* @return OrderItemInterface
@@ -63,6 +65,16 @@ public function convert($item, $data = [])
6365
'to_order_item',
6466
$item
6567
);
68+
if ($item instanceof \Magento\Quote\Model\Quote\Address\Item) {
69+
$orderItemData = array_merge(
70+
$orderItemData,
71+
$this->objectCopyService->getDataFromFieldset(
72+
'quote_convert_address_item',
73+
'to_order_item',
74+
$item
75+
)
76+
);
77+
}
6678
if (!$item->getNoDiscount()) {
6779
$data = array_merge(
6880
$data,

app/code/Magento/Quote/etc/fieldset.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,11 @@
186186
<aspect name="to_order_address" />
187187
</field>
188188
</fieldset>
189+
<fieldset id="quote_convert_address_item">
190+
<field name="quote_item_id">
191+
<aspect name="to_order_item" />
192+
</field>
193+
</fieldset>
189194
<fieldset id="quote_convert_item">
190195
<field name="sku">
191196
<aspect name="to_order_item" />

0 commit comments

Comments
 (0)