Cast order totals as floats when calculating net total (https://github.com/woocommerce/woocommerce-admin/pull/1945)
This commit is contained in:
parent
17ef1fc9c6
commit
b03362da68
|
@ -504,11 +504,11 @@ class WC_Admin_Reports_Orders_Stats_Data_Store extends WC_Admin_Reports_Data_Sto
|
||||||
* @return float
|
* @return float
|
||||||
*/
|
*/
|
||||||
protected static function get_net_total( $order ) {
|
protected static function get_net_total( $order ) {
|
||||||
$net_total = $order->get_total() - $order->get_total_tax() - $order->get_shipping_total();
|
$net_total = floatval( $order->get_total() ) - floatval( $order->get_total_tax() ) - floatval( $order->get_shipping_total() );
|
||||||
|
|
||||||
$refunds = $order->get_refunds();
|
$refunds = $order->get_refunds();
|
||||||
foreach ( $refunds as $refund ) {
|
foreach ( $refunds as $refund ) {
|
||||||
$net_total += $refund->get_total() - $refund->get_total_tax() - $refund->get_shipping_total();
|
$net_total += floatval( $refund->get_total() ) - floatval( $refund->get_total_tax() ) - floatval( $refund->get_shipping_total() );
|
||||||
}
|
}
|
||||||
|
|
||||||
return $net_total > 0 ? (float) $net_total : 0;
|
return $net_total > 0 ? (float) $net_total : 0;
|
||||||
|
|
Loading…
Reference in New Issue