Woocommerce is the most popular eCommerce Plugins, Its offer many features that are easy to use and great User experience. Anyone can manage it easily.
Woocommerce by default comes with many currency options for different countries. Sometimes, we need to add our special or own currency symbol and its currency. I will describe here how you can set your own currency without any issue.
Open the functions.php, located in the theme folder. My recommendation you should use child theme otherwise when its required update. all the codes will go.
Now, add the following lines of code at the end of the file and save the file.
add_filter( 'woocommerce_currencies', 'add_cw_currency' );
function add_cw_currency( $cw_currency ) {
$cw_currency['CLOUDWAYS'] = __( 'HTOT CURRENCY', 'woocommerce' );
return $cw_currency;
}
add_filter('woocommerce_currency_symbol', 'add_cw_currency_symbol', 10, 2);
function add_cw_currency_symbol( $custom_currency_symbol, $custom_currency ) {
switch( $custom_currency ) {
case 'CLOUDWAYS': $custom_currency_symbol = 'HTOT$'; break;
}
return $custom_currency_symbol;
}
For the example purpose, I will add a dummy currency with the name HTOT CURRENCYand will use the symbol, ‘HTOT$’ for it. You can add your own Currency name and currency Symbole.
Now, go to the backend of your WordPress website, WooCommerce > Settings.
Select Your Own Currency and save the settings.
Now Check the result, Go to the front end, and refresh the page. You will see the newly added custom currency being displayed at product pages.
Most important before try you should backup your site.
I discussed how to add custom currency and symbol in WooCommerce. If you need further help with the topic, Do leave a comment below and I will get back to you.