Skip to content

Commit

Permalink
Merge pull request #127 from Louzet/fix/nullable-channel-pricing
Browse files Browse the repository at this point in the history
call getPrice only if channelPrice is not null
  • Loading branch information
maximehuran committed Jun 30, 2023
2 parents 9d98c4e + 44aa15e commit 2f0058f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Model/Documentable/DocumentableProductTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ private function getCheapestVariantForChannel($channel)
$variants = $this->getEnabledVariants();
foreach ($variants as $variant) {
$channelPrice = $variant->getChannelPricingForChannel($channel);
if (null === $cheapestPrice || $channelPrice->getPrice() < $cheapestPrice) {
if (null !== $channelPrice && (null === $cheapestPrice || $channelPrice->getPrice() < $cheapestPrice)) {
$cheapestPrice = $channelPrice->getPrice();
$cheapestVariant = $variant;
}
Expand Down

0 comments on commit 2f0058f

Please sign in to comment.