Currencies

Adding currencies to the platform enables customers to pay for products by selecting the preferred currency.

Prefix

Adds a leading currency symbol i.e. $10.00.

If you need spacing consider a non-breaking space character (" "). Non-Breaking Space

Suffix

Adds a trailing currency symbol i.e. 10.00€.

If you need spacing consider a non-breaking space character (" "). Non-Breaking Space

Note: Please note the Euro symbol is not supported on Windows servers. The symbol € requires UTF-8 which is not supported by the system locales on Windows. Moving to ISO-8859-15 is not supported by MySQL. And moving to Windows-1252 will emulate the MySQL character set using latin1 which doesn't support the Euro currency symbol.

Automatic Updates

Since LiteCart 1.0.1.5 there is no longer a built in feature for updating currency values due to service termination by third party. Instead you can visit the official website for add-ons that can do this.

Can I fixate prices by currency with LiteCart?

Yes, you can set a separate fixated price by currency for each product.

Troubleshooting

The store currency should always have the value of 1.00.

Entity Object

$currency = new ent_currency();
$currency->data['code'] = 'XXX';
$currency->data['name'] = 'Currency Name';
$currency->data['value'] = 2.5;
$currency->save();

Reference Model

echo reference::currency(123)->name;

Database Query

$currency = database::query(
  "select * from ". DB_TABLE_PREFIX ."currencies
  where code = '". database::input($currency_code) ."'
  limit 1;"
)->fetch();

Session Currency

currency::set($currency_code);

var_dump(currency::$selected);

Currency Formatting and Calculating

$formatted_price_in_usd = currency::format($amount_in_store_currency, (bool)$auto_decimals, 'USD'); // $9.99
$html_price_in_usd = currency::format_html($amount_in_store_currency, (bool)$auto_decimals, 'USD'); // USD $9.99
$raw_price_in_usd = currency::format_raw($amount_in_store_currency, (bool)$auto_decimals, 'USD'); // 9.99

$converted_amount = currency::convert($amount, $from_currency_code, $to_currency_code);

Revisions

Recently Edited Articles
This website uses no cookies and no third party tracking technology. We think we can do better than others and really think about your privacy.