WooCommerce is the leading WordPress eCommerce plugin which offers many options for customising an online store. In this tutorial, I will highlight how to include your desired country currency code where your product price is displayed.
Currencies such as the Pound Sterling, Japanese Yen or even the Euro are very much self-explanatory when viewing a product. The dollar, however, can be perceived by customers like the Australian dollar, the US dollar and the NZ dollar; among others.
So how can we include a countries currency code with the price?
Add Currency Code As Prefix
Add the below PHP snippet to you theme or child theme‘s functions.php file.
add_filter('woocommerce_currency_symbol', 'alter_currency_symbol', 10, 2); function alter_currency_symbol( $currency_symbol, $currency ) { switch( $currency ) { case 'AUD': $custom_currency_symbol = 'AUD$'; break; } return $custom_currency_symbol; }
Add Currency Code As Suffix
Add the below PHP snippet to you theme or child theme‘s functions.php file.
function add_currency_symbol_suffix($format, $currency_pos) { switch ( $currency_pos ) { case 'left' : $currency = get_woocommerce_currency(); $format = '%1$s%2$s' . $currency; break; } return $format; } add_action('woocommerce_price_format', 'add_currency_symbol_suffix', 1, 2);
If you are looking to launch a website or online store for your business, request a free quote online or feel free to call me on 0468 629 301 and let’s discuss your ideas!