WordPress at Your Fingertips
function is not described

wc_add_number_precision() WC 3.2.0

Add precision to a number and return a number.

No Hooks.

Return

Int|float.

Usage

wc_add_number_precision( $value, $round );
$value(float) (required)
Number to add precision to.
$round(true|false)
If should round after adding precision.
Default: true

Changelog

Since 3.2.0 Introduced.

Code of wc_add_number_precision() WC 5.8.0

function wc_add_number_precision( $value, $round = true ) {
	$cent_precision = pow( 10, wc_get_price_decimals() );
	$value          = $value * $cent_precision;
	return $round ? NumberUtil::round( $value, wc_get_rounding_precision() - wc_get_price_decimals() ) : $value;
}