Skip to content

Commit d8d7d56

Browse files
committed
Merge branch 'master' of github.com:yireo/Yireo_GoogleTagManager2
2 parents 1428308 + 9833ce1 commit d8d7d56

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

DataLayer/Mapper/ProductDataMapper.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,11 @@ public function mapByProduct(ProductInterface $product): array
8282
} catch (NoSuchEntityException $noSuchEntityException) {
8383
}
8484

85-
$productData['price'] = $this->priceFormatter->format((float)$product->getFinalPrice());
85+
$productData['price'] = $this->priceFormatter->format((float) $product->getPriceInfo()->getPrice(FinalPrice::PRICE_CODE)->getValue());
86+
if ($product->getCustomOption('simple_product') && $product->getCustomOption('simple_product')->getProduct()) {
87+
$simpleProduct = $product->getCustomOption('simple_product')->getProduct();
88+
$productData['price'] = $this->priceFormatter->format((float) $simpleProduct->getPriceInfo()->getPrice(FinalPrice::PRICE_CODE)->getValue());
89+
}
8690

8791
$productData = $this->attachCategoriesData($product, $productData);
8892
$productData = $this->parseDataLayerMapping($product, $productData);

0 commit comments

Comments
 (0)