Skip to content

Commit

Permalink
Prevent PHP 8 warnings with converting tax rate floats.
Browse files Browse the repository at this point in the history
  • Loading branch information
dennisnissle committed Oct 15, 2024
1 parent ed0bf17 commit 793ca8c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions includes/class-wc-gzd-order-helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -894,20 +894,20 @@ public function order_item_tax_totals( $order_totals, $order, $tax_display = ''
if ( 'itemized' === get_option( 'woocommerce_tax_total_display' ) ) {
foreach ( $order->get_tax_totals() as $code => $tax ) {
$tax->rate = wc_gzd_get_order_tax_rate_percentage( $tax->rate_id, $order );
$rate_key = (string) $tax->rate;

if ( ! isset( $tax_array[ $tax->rate ] ) ) {
$tax_array[ $tax->rate ] = array(
if ( ! isset( $tax_array[ $rate_key ] ) ) {
$tax_array[ $rate_key ] = array(
'tax' => $tax,
'amount' => $tax->amount,
'contains' => array( $tax ),
);
} else {
array_push( $tax_array[ $tax->rate ]['contains'], $tax );
$tax_array[ $tax->rate ]['amount'] += $tax->amount;
array_push( $tax_array[ $rate_key ]['contains'], $tax );
$tax_array[ $rate_key ]['amount'] += $tax->amount;
}
}
} else {

$base_rate = WC_Tax::get_base_tax_rates();
$rate = reset( $base_rate );
$rate_id = key( $base_rate );
Expand Down

0 comments on commit 793ca8c

Please sign in to comment.