Skip to content

Commit

Permalink
MAGETWO-72251: Backport of MAGETWO-65607 for Magento 2.1: [GitHub][PR…
Browse files Browse the repository at this point in the history
…] Check return … #10750
  • Loading branch information
ishakhsuvarov authored Sep 4, 2017
2 parents 09e8dd7 + 36a2e1f commit 42a4cbb
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,15 @@ public function getFinalPrice($qty, $product)
*/
public function getPrice($product)
{
if ($product->getCustomOption('simple_product')) {
return $product->getCustomOption('simple_product')->getProduct()->getPrice();
} else {
return 0;
if (!empty($product)) {
$simpleProductOption = $product->getCustomOption('simple_product');
if (!empty($simpleProductOption)) {
$simpleProduct = $simpleProductOption->getProduct();
if (!empty($simpleProduct)) {
return $simpleProduct->getPrice();
}
}
}
return 0;
}
}

0 comments on commit 42a4cbb

Please sign in to comment.