A simple, powerful and independent e-commerce platform.
Sell anything with ease.

Add a custom currency and currency symbol

If your preferred currency is not included with Classic Commerce you can easily add it (and a custom currency symbol) using this code.

/**
 * Add a custom currency and currency symbol
 */

// Adds a custom currency and associated symbol if not already included with Classic Commerce 
// https://docs.woocommerce.com/document/add-a-custom-currency-symbol/

add_filter('woocommerce_currencies', 'cc_add_my_currency');
 
function cc_add_my_currency($currencies) {
  $currencies['ABC'] = __('New Currency Name', 'woocommerce');
  return $currencies;
}
 
add_filter('woocommerce_currency_symbol', 'cc_add_my_currency_symbol', 10, 2);
 
function cc_add_my_currency_symbol($currency_symbol, $currency) {
  switch($currency) {
    case 'ABC': $currency_symbol = '#'; break;
  }
    return $currency_symbol;
}
View Raw Code ID: 1553