How to Add Custom Currencies and Symbols in WooCommerce

The Importance of Customizing Currency Symbols

For some reason wanting to add custom currency symbols to your WooCommerce store might be:

1. Make e-commerce more diversified by offering multiple currency options to users.

2. Display product prices in the customer's local currency to increase intimacy and enhance the shopping experience.

3. Customers can easily choose their preferred currency, simplifying the shopping process.

4. Increased conversion rates.

5. Not having to worry about currency exchange, expanding store coverage and entering new markets.

图片[1]-如何在 WooCommerce 中添加自定义货币符号和货币

Adding Custom Currencies in WooCommerce

You can add custom currencies and their symbols to your WooCommerce store by following these steps:

1. Go to the WordPress site WooCommerce Dashboard > AppearanceThe

图片[2]-如何在 WooCommerce 中添加自定义货币符号和货币

2. Select "Theme File Editor".

图片[3]-如何在 WooCommerce 中添加自定义货币符号和货币

3. Open the functions.php fileThe

图片[4]-如何在 WooCommerce 中添加自定义货币符号和货币

4. Add the following code snippet to the end of the file and save the file.

add_filter( 'woocommerce_currencies', 'add_cw_currency' );
function add_cw_currency( $cw_currency ) {
     $cw_currency['CW'] = __( 'CW', '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 'CW': $custom_currency_symbol = 'CW$'; break;
     }
     return $custom_currency_symbol; }
}

take note of: See this section for an explanation of the code.

Go to the WordPress dashboard. Find the WooCommerce tab and click "Settings"The

图片[5]-如何在 WooCommerce 中添加自定义货币符号和货币

In "Currency options"Under click on "currency" drop-down menu, you will see the newly added custom currency appear at the end of the drop-down menu.

图片[6]-如何在 WooCommerce 中添加自定义货币符号和货币

From here, select the newly added currency and save the settings.

Validating Custom Code in WooCommerce

Here is a code breakdown of what we used in the above steps. The following function is used to add a custom currency:

add_filter( 'woocommerce_currencies', 'add_cw_currency' );
function add_cw_currency( $cw_currency ) {
     $cw_currency['CY'] = __( 'CY CURRENCY', 'woocommerce' ); }
     return $cw_currency;
}

I created a custom currency ofCW, which is shown on the back end.

The following function adds the currency symbol. I used theCW$as a currency symbol.

图片[7]-如何在 WooCommerce 中添加自定义货币符号和货币

Go to the front end of the site and refresh the page.

You will be able to see the newly added custom currency displayed on the product page.

图片[8]-如何在 WooCommerce 中添加自定义货币符号和货币

summarize

This tutorial lists the steps to add custom currencies and symbols to WooCommerce. The process is so simple that even newbies can follow the steps to add custom currencies and their symbols to their e-commerce site.


Contact Us
Can't read the article? Contact us for free answers! Free help for personal, small business sites!
Tel: 020-2206-9892
QQ咨询:1025174874
(iii) E-mail: info@361sale.com
Working hours: Monday to Friday, 9:30-18:30, holidays off
© Reprint statement
This article was written by Banner1
THE END
If you like it, support it.
kudos74 share (joys, benefits, privileges etc) with others
commentaries sofa-buying

Please log in to post a comment

    No comments