Skip to content

Currency ​

Type
Class
Namespace
craft\commerce\helpers
Inherits
craft\commerce\helpers\Currency
Since
2.0

Class Currency

View source

Public Methods ​

MethodDescription
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

formatAsCurrency() ​

Formats and optionally converts a currency amount into the supplied valid payment currency as per the rate setup in payment currencies.

View source

Arguments ​

Returns ​

string

Throws ​

round() ​

Rounds the amount as per the currency minor unit information. Not passing a currency model results in rounding in default currency.

View source

Arguments ​

Returns ​

float