From a1279e67c6c2506dcaac30d65bab611bf03c50fa Mon Sep 17 00:00:00 2001 From: barryhughes <3594411+barryhughes@users.noreply.github.com> Date: Wed, 18 May 2022 20:43:38 +0000 Subject: [PATCH] Switch to cast to coerce values into floats. --- plugins/woocommerce/includes/wc-core-functions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/woocommerce/includes/wc-core-functions.php b/plugins/woocommerce/includes/wc-core-functions.php index 48233441fbf..f9bc9b441f8 100644 --- a/plugins/woocommerce/includes/wc-core-functions.php +++ b/plugins/woocommerce/includes/wc-core-functions.php @@ -1884,9 +1884,9 @@ function wc_get_rounding_precision() { * @param bool $round If should round after adding precision. * @return int|float */ -function wc_add_number_precision( $value, $round = true ) { +function wc_add_number_precision( float $value, bool $round = true ) { $cent_precision = pow( 10, wc_get_price_decimals() ); - $value = '' === $value ? 0.0 : $value * $cent_precision; + $value = $value * $cent_precision; return $round ? NumberUtil::round( $value, wc_get_rounding_precision() - wc_get_price_decimals() ) : $value; }