Currency
- Type
- Class
- Namespace
- craft\commerce\helpers
- Inherits
- craft\commerce\helpers\Currency
- Since
- 2.0
Class Currency
View source (opens new window)
# Public Methods
| Method | Description |
|---|---|
| defaultDecimals() | |
| formatAsCurrency() | Formats and optionally converts a currency amount into the supplied valid payment currency as per the rate setup in payment currencies. |
| round() | Rounds the amount as per the currency minor unit information. Not passing a currency model results in rounding in default currency. |
# defaultDecimals()
View source (opens new window)
Returns
# formatAsCurrency()
Formats and optionally converts a currency amount into the supplied valid payment currency as per the rate setup in payment currencies.
View source (opens new window)
Arguments
$amount$currency$convert(boolean (opens new window))$format(boolean (opens new window))$stripZeros(boolean (opens new window))
Returns
# round()
Rounds the amount as per the currency minor unit information. Not passing a currency model results in rounding in default currency.
View source (opens new window)
Arguments
$amount(float (opens new window))$currency(craft\commerce\models\PaymentCurrency, null (opens new window))