WordPress at Your Fingertips
function is not described

Automattic\WooCommerce\Blocks\StoreApi\Formatters

MoneyFormatter::format() public WC 1.0

Format a given value and return the result.

{} It's a method of the class: MoneyFormatter{}

No Hooks.

Return

Mixed.

Usage

$MoneyFormatter = new MoneyFormatter();
$MoneyFormatter->format( $value, $options );
$value(mixed) (required)
Value to format.
$options(array)
Options that influence the formatting.
Default: []

Code of MoneyFormatter::format() WC 5.6.0

public function format( $value, array $options = [] ) {
	$options = wp_parse_args(
		$options,
		[
			'decimals'      => wc_get_price_decimals(),
			'rounding_mode' => PHP_ROUND_HALF_UP,
		]
	);

	return (string) intval(
		round(
			( (float) wc_format_decimal( $value ) ) * ( 10 ** absint( $options['decimals'] ) ),
			0,
			absint( $options['rounding_mode'] )
		)
	);
}