Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion DataLayer/Mapper/ProductDataMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Magento\Catalog\Api\Data\ProductInterface;
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Catalog\Pricing\Price\FinalPrice;
use Magento\ConfigurableProduct\Model\Product\Type\Configurable;
use Tagging\GTM\Api\Data\ProductTagInterface;
use Tagging\GTM\Api\Data\TagInterface;
Expand Down Expand Up @@ -98,7 +99,12 @@ public function mapByProduct(ProductInterface $product): array
} catch (NoSuchEntityException $noSuchEntityException) {
}

$productData['price'] = $this->priceFormatter->format((float)$product->getFinalPrice());
// Use the price info final price instead of getFinalPrice(): for grouped products the
// parent product itself has no price (getFinalPrice() returns 0) and Magento resolves the
// final price to the lowest priced associated product, which is what is shown on the front-end.
$productData['price'] = $this->priceFormatter->format(
(float)$product->getPriceInfo()->getPrice(FinalPrice::PRICE_CODE)->getValue()
);

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