Skip to content

Commit

Permalink
Fix division by zero error when cart total is zero (#412)
Browse files Browse the repository at this point in the history
  • Loading branch information
peterojo authored Aug 11, 2023
1 parent 53d152d commit 074bccf
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Subscriber/PaymentSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,10 @@ public function onShoppingCartLoaded(PageLoadedEvent $event)
}
}

$minorUnitsQuotient = $amountInMinorUnits / $page->getCart()->getPrice()->getTotalPrice();
$minorUnitsQuotient = 1;
if (0 < $page->getCart()->getPrice()->getTotalPrice()) {
$minorUnitsQuotient = $amountInMinorUnits / $page->getCart()->getPrice()->getTotalPrice();
}

$page->addExtension(
self::ADYEN_DATA_EXTENSION_ID,
Expand Down

0 comments on commit 074bccf

Please sign in to comment.