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.
{} Это метод класса: AbstractSchema{}
Хуков нет.
Возвращает
Строку
. The new amount.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->prepare_money_response( $amount, $decimals, $rounding_mode );
- $amount(строка/float) (обязательный)
- Monetary amount with decimals.
- $decimals(число)
- Number of decimals the amount is formatted with.
- $rounding_mode(число)
- Defaults to the PHP_ROUND_HALF_UP constant.
Код AbstractSchema::prepare_money_response() AbstractSchema::prepare money response WC 5.2.2
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,
]
);
}