Article updated in November 2026.
You often need to replace a currency symbol with text or add a custom value to it. WooCommerce does this with one filter. The example below replaces the Ukrainian hryvnia symbol. I needed the symbol in this format: грн/sq.m.
Replacing the currency symbol in WooCommerce
The filter is woocommerce_currency_symbol. It still works in current WooCommerce versions. To use it, follow these steps:
- Open the functions.php file of your theme. The path on FTP is wp-content/themes/your_theme/functions.php. A child theme is better, because a parent theme update would overwrite your changes. A snippets plugin such as Code Snippets also works.
- Add the following code at the very end of the file:
|
1 2 3 4 5 6 7 8 9 10 11 |
function add_my_currency( $currencies ) { $currencies['UAH'] = __( 'Ukrainian Hryvnia', 'woocommerce' ); return $currencies; } function add_my_currency_symbol( $currency_symbol, $currency ) { switch( $currency ) { case 'UAH': $currency_symbol = 'грн/sq.m'; break; } return $currency_symbol; } add_filter('woocommerce_currency_symbol', 'add_my_currency_symbol', 10, 2); |
Only the last function does the work, because it is the one hooked with add_filter. The add_my_currency function is not hooked anywhere. The hryvnia is already in the WooCommerce currency list, so you can leave that function out. It would only be needed to register a currency that WooCommerce doesn’t have, and it would then have to be hooked to the woocommerce_currencies filter.
You can do the same with any other currency: replace UAH with its code (USD, EUR, PLN and so on) and put your own text in place of the symbol. The result looks like this:
You can change the symbol without code too. In WooCommerce → Settings → General → Currency options you choose the currency, its position and the separators. That screen only offers the standard symbols, though. For custom text such as «грн/sq.m», the filter is the way to go.
Different currency symbols for different categories
You may want different symbols depending on the product category. In our projects, some sections show the price as грн/sq.m and others as грн/linear.m.
To change the symbol for one WooCommerce category, add this code at the end of functions.php:
|
1 2 3 4 5 6 7 |
add_filter('woocommerce_currency_symbol', 'change_existing_currency_symbol', 10, 2); function change_existing_currency_symbol( $currency_symbol, $currency ) { if ( 'UAH' === $currency && has_term( 'Clothing', 'product_cat', get_the_ID() ) ) { $currency_symbol = 'грн/linear.m'; } return $currency_symbol; // <== HERE } |
Here Clothing is the name of your category. has_term also accepts the category slug or ID. I replaced the unused global $post, $product line with get_the_ID(), so the check runs against the product currently being displayed.
Things to keep in mind
- If both snippets are active, the one registered later overrides the earlier one when both match. Keep the general symbol and the category rule in a single function if you can.
- The filter runs everywhere WooCommerce prints a currency symbol: catalog, cart, checkout, emails and the admin area. The category check needs a product in context. In the cart or in emails, the symbol may therefore not change the way it does on the product page. Test each place.
has_termdoes not match subcategories automatically. If the rule must apply to child categories, list them or check the parent terms separately.- After editing, clear your caching plugin and CDN cache, otherwise you will keep seeing the old price format.
- Keep a backup of functions.php. A syntax error in it can take the whole site down.
Using an AI assistant for this task
An assistant such as Claude can adapt these snippets to your currency and category slugs. It can also add conditions for cart and emails, or review your functions.php for syntax errors before you upload it. Always test the result on a staging site first.
I hope our article “Woocommerce currency symbol replacement + different symbols in different categories” was helpful to you.

Leave a Reply