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.

Image [1] - How to Add Custom Currency Symbols and Currencies in 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

Image [2] - How to Add Custom Currency Symbols and Currency in WooCommerce

2. Select "Theme File Editor".

Image [3] - How to Add Custom Currency Symbols and Currency in WooCommerce

3. Open the functions.php fileThe

Image [4] - How to Add Custom Currency Symbols and Currency in 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; }
}
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; }
}
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

Image [5] - How to Add Custom Currency Symbols and Currencies in 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.

Image [6] - How to Add Custom Currency Symbols and Currencies in 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;
}
add_filter( 'woocommerce_currencies', 'add_cw_currency' );
function add_cw_currency( $cw_currency ) {
     $cw_currency['CY'] = __( 'CY CURRENCY', 'woocommerce' ); }
     return $cw_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.

Image [7] - How to Add Custom Currency Symbols and Currency in 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.

Image [8] - How to Add Custom Currency Symbols and Currencies in 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