Skip to content

Commit c142e71

Browse files
author
Alexey Yakimovich
committed
MAGETWO-96545: Wrong calculation of invoiced items in shipment document in order with bundle product after partial invoice
- Fixed WebApi test issue;
1 parent 6cc7700 commit c142e71

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

app/code/Magento/Sales/Model/Service/InvoiceService.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,11 @@ private function prepareBundleQty(\Magento\Sales\Api\Data\OrderItemInterface $or
242242
{
243243
if ($orderItem->getProductType() == Type::TYPE_BUNDLE && !$orderItem->isShipSeparately()) {
244244
foreach ($orderItem->getChildrenItems() as $childItem) {
245-
$bundleSelectionAttributes = $this->serializer->unserialize(
246-
$childItem->getProductOptionByCode('bundle_selection_attributes')
247-
);
245+
$bundleSelectionAttributes = $childItem->getProductOptionByCode('bundle_selection_attributes');
246+
if (is_string($bundleSelectionAttributes)) {
247+
$bundleSelectionAttributes = $this->serializer->unserialize($bundleSelectionAttributes);
248+
}
249+
248250
$qtys[$childItem->getId()] = $qtys[$orderItem->getId()] * $bundleSelectionAttributes['qty'];
249251
}
250252
}

0 commit comments

Comments
 (0)