Show the Currency Code Next to Prices
Adds the three-letter currency code after prices on the front end, such as "$25.00 USD", so international shoppers know which dollar or crown you mean.
Opens WPIDE on
Code
add_filter( 'woocommerce_price_format', function ( $format ) {
if ( ( is_admin() && ! wp_doing_ajax() ) || false !== strpos( $format, 'wpide-currency-code' ) ) {
return $format;
}
return $format . ' <span class="wpide-currency-code">' . esc_html( get_woocommerce_currency() ) . '</span>';
}, 20 );
Notes
Admin screens are left unchanged; remove the symbol in WooCommerce settings if you prefer the code alone.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.