Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
how to add new currency and currency symbol in cbx accounting http://codeboxr.com/product/cbx-accounting/
add_filter('cbxwpsimpleaccounting_currencies', 'cbxwpsimpleaccounting_currencies_custom_currency');
//how to add new currency
/**
* Add new currency
*
* @param array $currency_arr
*
* @return array
*/
function cbxwpsimpleaccounting_currencies_custom_currency($currency_arr){
//at first check if the same currency code is added before
if(!isset($currency_arr['XYZ'])){
$currency_arr['XYZ'] = 'My Custom XYZ currency';
}
return $currency_arr;
}
//how to add symbol for the new currency
add_filter('cbxwpsimpleaccounting_currency_symbol','cbxwpsimpleaccounting_currency_symbol_xyx', 10, 2);
function cbxwpsimpleaccounting_currency_symbol_xyx($currency_symbol, $currency_code){
if($currency_code == 'XYZ') return '$X'; // where 'XYZ' is your known currency code and '$X' is your known currency suymbol
return $currency_symbol;
}
@manchumahara

This comment has been minimized.

Copy link
Owner Author

@manchumahara manchumahara commented May 20, 2019

Here is an example how to add Mongolian tögrög to CBX Accounting https://gist.github.com/manchumahara/6a432b33c7422c803822cfb1dffc5f7e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment