diff --git a/Plugin/Tax/Helper/Data.php b/Plugin/Tax/Helper/Data.php index 46c8e01a979..4dab1a67857 100644 --- a/Plugin/Tax/Helper/Data.php +++ b/Plugin/Tax/Helper/Data.php @@ -58,10 +58,20 @@ public function afterGetCalculatedTaxes(Subject $subject, array $result, $source $this->result = $result; $order = $source->getOrder(); + if (!$order->getPayment() || + strstr($order->getPayment()->getMethod(), 'mollie_methods_') === false + ) { + return $result; + } + $amount = $order->getMolliePaymentFee(); $taxAmount = $order->getMolliePaymentFeeTax(); $baseTaxAmount = $order->getMolliePaymentFee(); - $rate = round(($taxAmount / $amount) * 100); + + $rate = 0; + if ((float)$order->getMolliePaymentFeeTax()) { + $rate = round(($taxAmount / $amount) * 100); + } $taxClassId = $this->config->paymentSurchargeTaxClass( $order->getPayment()->getMethod(),