wc_add_number_precision( float $value, bool $round = true )
Add precision to a number and return a number.
Description Description
Parameters Parameters
- $value
-
(Required) Number to add precision to.
- $round
-
(Optional) If should round after adding precision.
Default value: true
Return Return
(int|float)
Source Source
File: includes/wc-core-functions.php
function wc_add_number_precision( $value, $round = true ) { $cent_precision = pow( 10, wc_get_price_decimals() ); $value = $value * $cent_precision; return $round ? round( $value, wc_get_rounding_precision() - wc_get_price_decimals() ) : $value; }
Changelog Changelog
Version | Description |
---|---|
3.2.0 | Introduced. |