wc_remove_number_precision()WC 3.2.0

Remove precision from a number and return a float.

No Hooks.

Return

float.

Usage

wc_remove_number_precision( $value );
$value(float) (required)
Number to add precision to.

Changelog

Since 3.2.0 Introduced.

wc_remove_number_precision() code WC 8.7.0

function wc_remove_number_precision( $value ) {
	if ( ! $value ) {
		return 0.0;
	}

	$cent_precision = pow( 10, wc_get_price_decimals() );
	return $value / $cent_precision;
}