Switch to cast to coerce values into floats.
This commit is contained in:
parent
dc98056178
commit
a1279e67c6
|
@ -1884,9 +1884,9 @@ function wc_get_rounding_precision() {
|
||||||
* @param bool $round If should round after adding precision.
|
* @param bool $round If should round after adding precision.
|
||||||
* @return int|float
|
* @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() );
|
$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;
|
return $round ? NumberUtil::round( $value, wc_get_rounding_precision() - wc_get_price_decimals() ) : $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue