diff --git a/plugins/woocommerce/changelog/fix-38444-unsupported-operands b/plugins/woocommerce/changelog/fix-38444-unsupported-operands new file mode 100644 index 00000000000..721eece20c1 --- /dev/null +++ b/plugins/woocommerce/changelog/fix-38444-unsupported-operands @@ -0,0 +1,4 @@ +Significance: patch +Type: fix + +fix string + string for PHP 8.X diff --git a/plugins/woocommerce/includes/abstracts/abstract-wc-order.php b/plugins/woocommerce/includes/abstracts/abstract-wc-order.php index 1b66647f5e3..c311ccd1d2e 100644 --- a/plugins/woocommerce/includes/abstracts/abstract-wc-order.php +++ b/plugins/woocommerce/includes/abstracts/abstract-wc-order.php @@ -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', ' ' . WC()->countries->inc_tax_or_vat() . '', $this, $tax_display );