Skip to content

Commit

Permalink
Merge pull request #163 from chrisgan/bugfix/162
Browse files Browse the repository at this point in the history
Change precision of tax rate to 1DP. #162
  • Loading branch information
loueranta-paytrail committed Aug 5, 2024
2 parents 3fa41a8 + 8c02a7e commit 7089f5c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ final class Gateway extends \WC_Payment_Gateway {
* @var Helper
*/
protected $helper = null;
const TAX_RATE_PRECISION = 1;

/**
* Object constructor
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 7089f5c

Please sign in to comment.