Automattic\WooCommerce\StoreApi\Schemas\V1
AbstractSchema::prepare_money_response()
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(int)
- Number of decimals the amount is formatted with.
По умолчанию: 2 - $rounding_mode(int)
- Defaults to the PHP_ROUND_HALF_UP constant.
По умолчанию: PHP_ROUND_HALF_UP
Код AbstractSchema::prepare_money_response() AbstractSchema::prepare money response WC 7.5.1
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, ] ); }