From c116c20e76a3016bcbb8db78adc579a6331c191d Mon Sep 17 00:00:00 2001 From: DRC Date: Mon, 26 Oct 2020 15:31:48 +0100 Subject: [PATCH] Correctly pick product id for configurable products --- src/Model/Resolver/ProductResolver.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Model/Resolver/ProductResolver.php b/src/Model/Resolver/ProductResolver.php index eab7c68..0a8d700 100755 --- a/src/Model/Resolver/ProductResolver.php +++ b/src/Model/Resolver/ProductResolver.php @@ -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']); @@ -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();