If 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:
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):
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):