Skip to content

Commit

Permalink
Update datalayer price to have keep working for add to cart event for…
Browse files Browse the repository at this point in the history
… configurable products (issue #233)
  • Loading branch information
Florin Mandoc committed Nov 7, 2024
1 parent 1806f04 commit 4e29848
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions DataLayer/Mapper/ProductDataMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ public function mapByProduct(ProductInterface $product): array
}

$productData['price'] = $this->priceFormatter->format((float) $product->getPriceInfo()->getPrice(FinalPrice::PRICE_CODE)->getValue());
if ($product->getCustomOption('simple_product') && $product->getCustomOption('simple_product')->getProduct()) {
$simpleProduct = $product->getCustomOption('simple_product')->getProduct();
$productData['price'] = $this->priceFormatter->format((float) $simpleProduct->getPriceInfo()->getPrice(FinalPrice::PRICE_CODE)->getValue());
}

$productData = $this->attachCategoriesData($product, $productData);
$productData = $this->parseDataLayerMapping($product, $productData);
Expand Down

0 comments on commit 4e29848

Please sign in to comment.