CurrencyServiceInterface
The currency service is used to manage currencies in the context of storefront.
Tags
Methods¶
                 getAvailableCurrencies()
            ¶
getAvailableCurrencies()
            ¶
    
        Returns list of the currencies assigned to the storefront.
|  |  | 
Return values
iterable<string|int, CurrencyInterface>
                 getCurrencyByCode()
            ¶
getCurrencyByCode()
            ¶
    
        |  |  | 
Parameters
| Name | Type | Default value | Description | 
|---|---|---|---|
| $code | string | - | - | 
Return values
Tags
                 getDefaultCurrency()
            ¶
getDefaultCurrency()
            ¶
    
        Get the default currency according to user preferences.
|  |  | 
Default currency is used when no currency is set in the session.
Return values
CurrencyInterface|null
                 getSessionCurrency()
            ¶
getSessionCurrency()
            ¶
    
        Get the currency used in the current user session (or null if not set).
|  |  | 
Currency stored in the session is usually manually selected by user and has higher priority than the "default" currency.
Return values
CurrencyInterface|null
Tags
                 isAcceptable()
            ¶
isAcceptable()
            ¶
    
        Checks if the currency can be used in the current storefront.
|  |  | 
Parameters
| Name | Type | Default value | Description | 
|---|---|---|---|
| $currency | CurrencyInterface | - | - | 
Return values
bool
                 setDefaultCurrency()
            ¶
setDefaultCurrency()
            ¶
    
        Sets the default currency for the current user.
|  |  | 
Parameters
| Name | Type | Default value | Description | 
|---|---|---|---|
| $currency | CurrencyInterface|null | - | - | 
Tags
                 setSessionCurrency()
            ¶
setSessionCurrency()
            ¶
    
        Sets the currency to be used for a current user session.
|  |  | 
Currency stored in the session is usually manually selected by user and has higher priority than the "default" currency.
Parameters
| Name | Type | Default value | Description | 
|---|---|---|---|
| $currency | CurrencyInterface|null | - | - |