diff --git a/ViewModel/Pixel.php b/ViewModel/Pixel.php index 9eb2877..cd90108 100644 --- a/ViewModel/Pixel.php +++ b/ViewModel/Pixel.php @@ -132,11 +132,11 @@ public function getOrderDetails() $this->orderDetails['tax'] = number_format((float)$order->getTaxAmount() ?? 0.0, 2, '.', ''); $this->orderDetails['shipping'] = number_format((float)$order->getShippingAmount() ?? 0.0, 2, '.', ''); if (!$this->taxConfig->discountTax()) { - $this->orderDetails['discount'] = number_format((float)abs($order->getDiscountAmount()) ?? 0.0, 2, '.', ''); + $this->orderDetails['discount'] = number_format((float)abs((float)$order->getDiscountAmount()) ?? 0.0, 2, '.', ''); } else { //when discount is applied to products "including tax" - extract tax compensation amount from "discount". $this->orderDetails['discount'] = number_format( - (float)abs($order->getDiscountAmount()) - (float)abs($order->getDiscountTaxCompensationAmount()) ?? 0.0, 2, '.', '' + (float)abs((float)$order->getDiscountAmount()) - (float)abs((float)$order->getDiscountTaxCompensationAmount()) ?? 0.0, 2, '.', '' ); }