From 8c02a7e2394f5acee0e2fa2bef9d1b2c1edd04ac Mon Sep 17 00:00:00 2001 From: Chris Gan <2246778+chrisgan@users.noreply.github.com> Date: Mon, 5 Aug 2024 11:15:09 +0100 Subject: [PATCH] Change precision of tax rate to 1DP. #162 --- src/Gateway.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Gateway.php b/src/Gateway.php index 3f780851..e54a78e2 100644 --- a/src/Gateway.php +++ b/src/Gateway.php @@ -118,6 +118,7 @@ final class Gateway extends \WC_Payment_Gateway { * @var Helper */ protected $helper = null; + const TAX_RATE_PRECISION = 1; /** * Object constructor @@ -2086,7 +2087,7 @@ protected function get_item_tax_rate( WC_Order_Item $item) { } if ( $total_price > 0 && $tax_total > 0) { - $tax_rate = NumberUtil::round( ( $tax_total / $total_price ) * 100, wc_get_price_decimals() ); + $tax_rate = NumberUtil::round( ( $tax_total / $total_price ) * 100, self::TAX_RATE_PRECISION ); } else { $tax_rate = 0; }