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
drc0 committed Jul 12, 2021
1 parent 637e9c2 commit c116c20
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 @@ -114,6 +114,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 @@ -154,7 +157,8 @@ public function resolve(
}

/** @var $item Item */
$data[$key] = $productItem;
$productId = $item->getChildrenItems() ? $item->getChildrenItems()[0]->getProduct()->getId() : $item->getProductId();
$data[$key] = $productsData[$productId];
$data[$key]['qty'] = $item->getQtyOrdered();
$data[$key]['row_total'] = $item->getRowTotalInclTax();
$data[$key]['original_price'] = $item->getOriginalPrice();
Expand Down

0 comments on commit c116c20

Please sign in to comment.