Fix non numeric warning for orders.
This commit is contained in:
parent
6ac86952bb
commit
8f63211f1c
|
@ -1194,7 +1194,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
|||
if ( $inc_tax ) {
|
||||
$subtotal = ( $item->get_subtotal() + $item->get_subtotal_tax() ) / max( 1, $item->get_quantity() );
|
||||
} else {
|
||||
$subtotal = ( $item->get_subtotal() / max( 1, $item->get_quantity() ) );
|
||||
$subtotal = ( intval( $item->get_subtotal() ) / max( 1, $item->get_quantity() ) );
|
||||
}
|
||||
|
||||
$subtotal = $round ? number_format( (float) $subtotal, wc_get_price_decimals(), '.', '' ) : $subtotal;
|
||||
|
@ -1242,7 +1242,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
|||
if ( $inc_tax ) {
|
||||
$total = ( $item->get_total() + $item->get_total_tax() ) / max( 1, $item->get_quantity() );
|
||||
} else {
|
||||
$total = $item->get_total() / max( 1, $item->get_quantity() );
|
||||
$total = intval( $item->get_total() ) / max( 1, $item->get_quantity() );
|
||||
}
|
||||
|
||||
$total = $round ? round( $total, wc_get_price_decimals() ) : $total;
|
||||
|
|
|
@ -96,7 +96,7 @@ class WC_Order_Item_Product extends WC_Order_Item {
|
|||
* @throws WC_Data_Exception
|
||||
*/
|
||||
public function set_subtotal( $value ) {
|
||||
$this->set_prop( 'subtotal', wc_format_decimal( $value ) );
|
||||
$this->set_prop( 'subtotal', intval( wc_format_decimal( $value ) ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -106,7 +106,7 @@ class WC_Order_Item_Product extends WC_Order_Item {
|
|||
* @throws WC_Data_Exception
|
||||
*/
|
||||
public function set_total( $value ) {
|
||||
$this->set_prop( 'total', wc_format_decimal( $value ) );
|
||||
$this->set_prop( 'total', intval( wc_format_decimal( $value ) ) );
|
||||
|
||||
// Subtotal cannot be less than total
|
||||
if ( ! $this->get_subtotal() || $this->get_subtotal() < $this->get_total() ) {
|
||||
|
|
Loading…
Reference in New Issue