From 7217eaf95045c040d1d220b992a3b32cf3248c14 Mon Sep 17 00:00:00 2001 From: Jon Lowe Date: Fri, 8 Dec 2023 16:36:25 -0800 Subject: [PATCH] TS-413: some plugins apparently are having the magento extension library call to getDiscountAmount return strings when it's supposed to return float or null. Customer had "0.00" returned so we are type casting to convert what can be converted. --- Block/Checkout/Success.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Block/Checkout/Success.php b/Block/Checkout/Success.php index 7c21a6f..6803bc2 100755 --- a/Block/Checkout/Success.php +++ b/Block/Checkout/Success.php @@ -101,6 +101,8 @@ public function getOrderId(): string public function getSubtotal() { $order = $this->getOrder(); - return $order->getBaseSubtotal() - abs($order->getDiscountAmount() ?: 0); + + // float added to type cast from string as some plugins were writing strings of the values. + return $order->getBaseSubtotal() - abs((float)$order->getDiscountAmount() ?: 0); } }