Skip to content

Commit 4e29848

Browse files
author
Florin Mandoc
committed
Update datalayer price to have keep working for add to cart event for configurable products (issue #233)
1 parent 1806f04 commit 4e29848

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

DataLayer/Mapper/ProductDataMapper.php

+4
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ public function mapByProduct(ProductInterface $product): array
8383
}
8484

8585
$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)