diff --git a/DataLayer/Mapper/ProductDataMapper.php b/DataLayer/Mapper/ProductDataMapper.php index a710472..8c42909 100644 --- a/DataLayer/Mapper/ProductDataMapper.php +++ b/DataLayer/Mapper/ProductDataMapper.php @@ -83,8 +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(); + + $simpleProductOption = $product->getCustomOption('simple_product'); + if ($simpleProductOption && method_exists($simpleProductOption, 'getProduct') && $simpleProductOption->getProduct()) { + $simpleProduct = $simpleProductOption->getProduct(); $productData['price'] = $this->priceFormatter->format((float) $simpleProduct->getPriceInfo()->getPrice(FinalPrice::PRICE_CODE)->getValue()); }