+321 123 4567
info@test.com
  • Home
  • My Services
    • Web Design
    • Web Development
    • Technical Writing
    • Portfolio
  • My Thoughts
  • Free Tools
    • Photo Editor
    • Avatar Generator
    • Email Migration Tool
    • QR Code Generator
    • RSS to HTML Converter
    • IP Address Geolocation
    • Base64 Image Encoder
    • NATO Translator
    • All Tools
  • Contact
Home
Wordpress
How to Add Nigerian Naira and other Currencies to WooCommerce

How to Add Nigerian Naira and other Currencies to WooCommerce

Wale Adekile
December 7, 2013

WooCommerce transforms your WordPress blog to an online store with and I recently had to use it on a client’s website. Although it’s free and works great, there are lots of features you need to manually add through functions.php or find a plugin to do the job. One of such is the limited currencies available from the dashboard. The online store is based in Nigeria and it only makes sense to ensure the currency is in Naira.


woocommerce

In my search to find a solution, I stumbled across this code by Sean Barton. By editing this code you can add just about any currency to your store:

add_filter('woocommerce_currencies', 'sb_add_ngn_currency');
add_filter('woocommerce_currency_symbol', 'sb_add_ngn_currency_symbol', 10, 2);
function sb_add_ngn_currency($currencies) {
$currencies['NGN'] = __( 'Nigerian Naira (NGN)', 'woocommerce' );
return $currencies;
}
function sb_add_ngn_currency_symbol($currency_symbol, $currency) {
switch( $currency ) {
case 'NGN':
$currency_symbol = '₦';
break;
}
return $currency_symbol;
}

It’s easy to edit this code and there are just a few things to change to add your own custom currency. For example, to add the Vietnamese Dong, you should have this:

add_filter('woocommerce_currencies', 'sb_add_vnd_currency');
add_filter('woocommerce_currency_symbol', 'sb_add_vnd_currency_symbol', 10, 2);
function sb_add_ngn_currency($currencies) {
$currencies['VND'] = __( 'Vietnames Dong (VND)', 'woocommerce' );
return $currencies;
}
function sb_add_vnd_currency_symbol($currency_symbol, $currency) {
switch( $currency ) {
case 'VND':
$currency_symbol = '₫';
break;
}
return $currency_symbol;
}

For your currency code and exact symbol to use, you may check this page. You can change this to work the way you want and add any currency.


Previous Post
Tips for Taking Advantage of Google+ For SEO
Next Post
How to Enlarge Images and Retain Picture Quality
Wale Adekile
Husband to the world's most beautiful woman and father to two awesome kids. A nerd, obviously; also, a technical business analyst, a web designer who preaches the gospel of WordPress, and a writer. You can check out my published books on Amazon.
email routing
Wordpress

Fix: WordPress Contact Form Not Sending Mails to Custom Email

13 years ago
analytics
Wordpress

WordPress SEO: Fixing Internal Duplicate Content & Low Quality Pages

11 years ago

Recent Articles

yunmai massage gun mini 2.
Yunmai Massage Gun Mini 2 Review
BenQ LaptopBar Review: The Accessory I didn’t Know I Needed
teendow g20
Teendow Robot Vacuum G20 Review
Yunmai EasePro Massage Gun Review
bathroom
Dear Men, Spraying All Over the Toilet Seat is Disgusting and Irresponsible
winx mediatrans
How to Transfer Photos from iPhone to Computer Without iTunes
How to Use WhatsApp on an iPad
Things to Consider When Buying a MacBook
programmer
Learning to Code: A Comprehensive Guide for Beginners
identity thief
How to Efficiently Prevent Identity Theft

All contents on this blog are copyright protected and cannot be reproduced on other websites without permission.

Copyright © 2022 – NerdieDad | Home | Contact | About | Privacy Policy