fix string + string for PHP 8.X (#38534)

This commit is contained in:
Ron Rennick 2023-06-05 07:28:03 -03:00 committed by GitHub
commit d8e534410f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: fix
fix string + string for PHP 8.X

View File

@ -489,9 +489,9 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
*/
public function get_total_discount( $ex_tax = true ) {
if ( $ex_tax ) {
$total_discount = $this->get_discount_total();
$total_discount = (float) $this->get_discount_total();
} else {
$total_discount = $this->get_discount_total() + $this->get_discount_tax();
$total_discount = (float) $this->get_discount_total() + (float) $this->get_discount_tax();
}
return apply_filters( 'woocommerce_order_get_total_discount', NumberUtil::round( $total_discount, WC_ROUNDING_PRECISION ), $this );
}
@ -2176,7 +2176,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
} else {
// Show shipping including tax.
$shipping = wc_price( $this->get_shipping_total() + $this->get_shipping_tax(), array( 'currency' => $this->get_currency() ) );
$shipping = wc_price( (float) $this->get_shipping_total() + (float) $this->get_shipping_tax(), array( 'currency' => $this->get_currency() ) );
if ( (float) $this->get_shipping_tax() > 0 && ! $this->get_prices_include_tax() ) {
$shipping .= apply_filters( 'woocommerce_order_shipping_to_display_tax_label', '&nbsp;<small class="tax_label">' . WC()->countries->inc_tax_or_vat() . '</small>', $this, $tax_display );