Skip to content

Commit

Permalink
Correctly pick product id for configurable products
Browse files Browse the repository at this point in the history
  • Loading branch information
stack committed Oct 26, 2020
1 parent 6f6172f commit 2c6023c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Model/Resolver/ProductResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ public function resolve(
}

$productIds = array_map(function ($item) {
foreach ($item->getChildrenItems() as $item){
return $item->getProduct()->getId();
}
return $item['product_id'];
}, $value['products']);

Expand Down Expand Up @@ -117,7 +120,8 @@ public function resolve(

foreach ($value['products'] as $key => $item) {
/** @var $item Item */
$data[$key] = $productsData[$item->getProductId()];
$productId = $item->getChildrenItems() ? $item->getChildrenItems()[0]->getProduct()->getId() : $item->getProductId();
$data[$key] = $productsData[$productId];
$data[$key]['qty'] = $item->getQtyOrdered();
$data[$key]['row_total'] = $item->getBaseRowTotalInclTax();
$data[$key]['original_price'] = $item->getBaseOriginalPrice();
Expand Down

0 comments on commit 2c6023c

Please sign in to comment.