Skip to content

Commit

Permalink
Merge pull request #1 from bitbull-team/feature/credit-memo-with-free…
Browse files Browse the repository at this point in the history
…-shipping

Feature/credit memo with free shipping
  • Loading branch information
mirkocesaro authored May 12, 2021
2 parents 1a17105 + 8143f35 commit 6faa647
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Model/Total/Creditmemo.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@ private function setCustomRefund(MagentoCreditmemo $creditmemo)

private function isPartialShippingRefunded(MagentoCreditmemo $creditmemo)
{
if($creditmemo->getOrder()->getShippingAmount()<=0)
{
//prevent division by zero when the shipping amount is 0
return false;
}
$part = $creditmemo->getShippingAmount() / $creditmemo->getOrder()->getShippingAmount();

return $part < 1 && $creditmemo->getOrder()->getShippingTaxAmount() > 0;
Expand Down

0 comments on commit 6faa647

Please sign in to comment.