Commit 628bdc793c9 for woocommerce

commit 628bdc793c9c45a1403d08776ec4d527c82c8383
Author: SH Sajal Chowdhury <72102985+shsajalchowdhury@users.noreply.github.com>
Date:   Fri Jun 19 14:00:27 2026 +0600

    Fix: Cast refund values to float before arithmetic in sales-by-date report (#64362)

diff --git a/plugins/woocommerce/changelog/pr-64362 b/plugins/woocommerce/changelog/pr-64362
new file mode 100644
index 00000000000..7ba1947a8a4
--- /dev/null
+++ b/plugins/woocommerce/changelog/pr-64362
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+Cast refund amount values to float for PHP 8.1 TypeError fix.
diff --git a/plugins/woocommerce/includes/admin/reports/class-wc-report-sales-by-date.php b/plugins/woocommerce/includes/admin/reports/class-wc-report-sales-by-date.php
index e5d81df0079..c7c900682bd 100644
--- a/plugins/woocommerce/includes/admin/reports/class-wc-report-sales-by-date.php
+++ b/plugins/woocommerce/includes/admin/reports/class-wc-report-sales-by-date.php
@@ -408,14 +408,14 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report {
 		$this->report_data->refunded_orders = array_merge( $this->report_data->partial_refunds, $this->report_data->full_refunds );

 		foreach ( $this->report_data->refunded_orders as $key => $value ) {
-			$this->report_data->total_tax_refunded          += floatval( $value->total_tax < 0 ? $value->total_tax * -1 : $value->total_tax );
+			$this->report_data->total_tax_refunded          += abs( (float) $value->total_tax );
 			$this->report_data->total_refunds               += floatval( $value->total_refund );
-			$this->report_data->total_shipping_tax_refunded += floatval( $value->total_shipping_tax < 0 ? $value->total_shipping_tax * -1 : $value->total_shipping_tax );
-			$this->report_data->total_shipping_refunded     += floatval( $value->total_shipping < 0 ? $value->total_shipping * -1 : $value->total_shipping );
+			$this->report_data->total_shipping_tax_refunded += abs( (float) $value->total_shipping_tax );
+			$this->report_data->total_shipping_refunded     += abs( (float) $value->total_shipping );

 			// Only applies to partial.
 			if ( isset( $value->order_item_count ) ) {
-				$this->report_data->refunded_order_items += floatval( $value->order_item_count < 0 ? $value->order_item_count * -1 : $value->order_item_count );
+				$this->report_data->refunded_order_items += abs( (int) $value->order_item_count );
 			}
 		}