WordPress at Your Fingertips
function is not described

Automattic\WooCommerce\Blocks\StoreApi\Schemas

AbstractSchema::prepare_money_response() protected WC 1.0

Convert monetary values from WooCommerce to string based integers, using the smallest unit of a currency.

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

No Hooks.

Return

String. The new amount.

Usage

// protected - for code of main (parent) or child class
$result = $this->prepare_money_response( $amount, $decimals, $rounding_mode );
$amount(string|float) (required)
Monetary amount with decimals.
$decimals(int)
Number of decimals the amount is formatted with.
Default: 2
$rounding_mode(int)
Defaults to the PHP_ROUND_HALF_UP constant.
Default: PHP_ROUND_HALF_UP

Code of AbstractSchema::prepare_money_response() WC 5.6.0

protected function prepare_money_response( $amount, $decimals = 2, $rounding_mode = PHP_ROUND_HALF_UP ) {
	return $this->extend->get_formatter( 'money' )->format(
		$amount,
		[
			'decimals'      => $decimals,
			'rounding_mode' => $rounding_mode,
		]
	);
}