Currency ​
- Type
- Class
- Namespace
- craft\commerce\helpers
- Inherits
- craft\commerce\helpers\Currency
- Since
- 2.0
Class Currency
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. |
moneyInputHtml() | |
round() | Rounds the amount as per the currency minor unit information. Not passing a currency model results in rounding in default currency. |
defaultDecimals()
​
Returns ​
Throws ​
formatAsCurrency()
​
Formats and optionally converts a currency amount into the supplied valid payment currency as per the rate setup in payment currencies.
Arguments ​
Returns ​
Throws ​
moneyInputHtml()
​
- Since
- 5.0.0
Arguments ​
$value
(mixed
)$config
(array)
Returns ​
Throws ​
round()
​
Rounds the amount as per the currency minor unit information. Not passing a currency model results in rounding in default currency.
Arguments ​
$amount
(float) – The amount as a decimal/float$currency
(craft\commerce\models\PaymentCurrency, string,\Money\Currency
, null)