How To Add Custom Currency With A Symbol In Woocommerce

In this article, we will learn How to add custom currency with a symbol in woocommerce.

You can set your default currency from the dashboard.

Admin Bar -> Woocommerce -> settings -> Currency options -> Currency.

Here, you can select the Currency.

But, if you want Any Different Currency with its Symbol which is not in the woo-commerce currency option…

To add your custom currency simply add Blow code to your child theme’s fuction.php file.

Note: Please don’t add code to the parent theme’s fuction.php file. cause when you update the parent theme this file will be wiped entirely.

So, Add this code to your child theme’s fuction.php file.

add_filter( 'woocommerce_currencies', 'add_custom_currency' );
function add_custom_currency( $cf_currency ) {
     $cf_currency['CUBA'] = __( 'Cuba Peso', 'woocommerce' );
     return $cf_currency;
}
add_filter('woocommerce_currency_symbol', 'add_custom_currency_symbol', 10, 2);
function add_custom_currency_symbol( $custom_currency_symbol, $custom_currency ) {
     switch( $custom_currency ) {
         case 'CUBA': $custom_currency_symbol = '₱'; break;
     }
     return $custom_currency_symbol;
}

After Add code, You can select your custom currency with a currency symbol from

Woocommerce -> settings -> Currency options -> Currency.

Now refresh, product page you can see our newly added currency symbol.

Here, we can go with our custom currency with a symbol.

If You want to add a custom price then Also check For Add Shipping Fees To Product Price Dynamically While Adding To The Cart.

Submit a Comment

Your email address will not be published. Required fields are marked *

Subscribe

Select Categories