Follow me on social media:

How To Add Currency Code As Suffix To Prices In WooCommerce

WooCommerceIf you’re looking for a way to modify the price so that your currency code becomes a suffix to your prices in WooCommerce you’ve come to the right code snippet tutorial.

I’m going to show you how to make prices that look like this:


Into this:

$49 AUD

When I was relaunching my site for ThirstyAffiliates we brought the shopping cart experience home with WooCommerce.

During the process I changed my pricing to AUD (Australian Dollars) but because the currency symbol ($) is the same as USD I thought it might cause some confusion if the first place they saw AUD was in PayPal when they got through to process their payment.

I’ve written previously about changing the currency symbol in WooCommerce to include your currency code, but it leaves the prices looking a little unnatural like this “AUD$49”.

The first step is easy enough, create a function to filter the price format in WooCommerce.

WooCommerce makes this ridiculously easy with it’s ample hooks and filters API, we just jump into the “woocommerce_price_format” action.

Here’s the code snippet which will add the suffix to all your prices throughout the site (copy and paste into your functions.php):

function addPriceSuffix($format, $currency_pos) {
	switch ( $currency_pos ) {
		case 'left' :
			$currency = get_woocommerce_currency();
			$format = '%1$s%2$s ' . $currency;
	return $format;
add_action('woocommerce_price_format', 'addPriceSuffix', 1, 2);

I also wanted the ability to just show the currency code suffix on prices in the cart and checkout pages, leaving my product pages and listings all unaffected.

To do this you need to wrap this add_action with another function that only gets called on those pages.

We use two new actions to call our function to add the action for modifying the price format. Tricky stuff!

Here’s the full code snippet for restricting the formatting to cart and checkout (copy and paste into your functions.php):

function addPriceSuffix($format, $currency_pos) {
	switch ( $currency_pos ) {
		case 'left' :
			$currency = get_woocommerce_currency();
			$format = '%1$s%2$s ' . $currency;
	return $format;
function addPriceSuffixAction() {
	add_action('woocommerce_price_format', 'addPriceSuffix', 1, 2);
add_action('woocommerce_before_cart', 'addPriceSuffixAction');
add_action('woocommerce_review_order_before_order_total', 'addPriceSuffixAction');

Hope this helps you, if it does feel free to leave a comment πŸ™‚

31 thoughts on “How To Add Currency Code As Suffix To Prices In WooCommerce

  1. Perfect! I needed a way to show the base currency when using the Currency Converter plugin. The first snippet worked like a charm. Thanks for the post!

  2. Awesome. Thanks so much for the post Josh! I have another problem, is there any way to have three decimal places for product prices but have only two for subtotal and total?

    1. Hey Jovan,

      In this snippet or just in general?

      In this snippet just replace the format line with
      $format = '%1$s%2$s';

      Otherwise you can use get_product() from the WooCommerce API then on that object use the get_price() function or get_price_html() if you want HTML formatted.

  3. Thanks for this it is almost what I am looking for πŸ™‚

    I applied your code so I got this €9,99 EUR. But is there a way to change it to 9,99 €?

    I tired your advice to Jovan but this did not help.

    Thank you for help.

    1. Hey Miro,

      You probably want to change the setting in the backend of Woo to use right hand side currency, then in the code above use case ‘right’ instead of left. After that follow the rest of the instructions, but alter the format to

      $format = '%2$s%1$s ' . $currency;
  4. Thanks, that first snippet worked perfectly to add AUD to all prices in my store and saved me heaps of time looking it up. Appreciate your article!

  5. Hi Josh,

    Thank you very much for the snippets, they are exactly what I needed.

    If I may ask for your help. I have one issue on my checkout page. The AUD is showing after the prices when the page loads, but as soon as the cart totals finish loading (little spinning wheel) the AUD disappears. I am using the first snippet as I want the currency to be shown on all product areas.

    Thank you very much again and I appreciate any help or suggestions.

  6. Perfect…exactly what I needed. 1 question…is there an easy way to make this currency symbol appear in a smaller font size than the price itself?

    1. Hi Willy Y,

      This would have to be done in CSS, you could wrap the symbol in a tag with a special class on it though.

      Hope this helps point you in the right direction.


    2. Great, the first snippet worked perfectly, just what I needed! But could you elaborate on how I would go about wrapping the currency code (USD, GBP, etc) in a special class in order that I can then make the font size smaller than the main price? Many, many thanks. James

    3. Not to worry, just figured out a way to do this myself. Not sure if this is the BEST way, so please let me know if it can be improved. So I have tweaked the first code snippet to add a custom “currency-suffix” class:

      function addPriceSuffix($format, $currency_pos) {
      switch ( $currency_pos ) {
      case ‘left’ :
      $currency = ”;
      $currency .= get_woocommerce_currency();
      $currency .= ”;
      $format = ‘%1$s%2$s ‘ . $currency;

      return $format;

      add_action(‘woocommerce_price_format’, ‘addPriceSuffix’, 1, 2);

      Then I added this to my custom css:

      /* Make the currency code suffix smaller than the main price */
      .woocommerce-page div.product p.price span.currency-suffix {
      font-size: 15px;

      Cheers, James πŸ™‚

    4. Ok, so posting the code like that didn’t work! Admin, can you email me and I will send you the code, then perhaps you can tweak my reply to show this properly, or perhaps update your post to show it? Cheers, James

  7. Hi Josh,

    I couldn’t get this to work with the code you provided. Should the above code work as is without using your first method (I have your first method working btw). I also tried changing the WooCommerce setting for right side currency but still no change, the area is just blank without using the first method.

    BTW, I’m using version 2.3.8

    If you could help me out that would be terrific, thanks.

    1. Works OK for me still. Just tested with latest WordPress and WooCommerce.

      Make sure you install in functions.php in your theme. Not some other functions.php.

  8. Great Thanks. This is what I am looking for. The first code is working fine, but the second code did not work for me. How can I place the AUD at the end of the amount instead of at the front.

  9. Thanks for this. I added your code to my functions.php file in my child theme and it works to pull up my default CAD currency. However, when switching to USD, the currency code is left off. Would you be able to advise on this? Thanks in advance!

    1. Hello Izzatullo,

      One was is to add a simple conditional directly before the assignment of ‘format’:

      if ( $currency == ‘UZS’ ) { $currency = “Бўм”; }

      You could use a switch if you have multiple of these you’d like to use.

Leave a Reply

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