Wpd Woocommerce Currency Symbol

Alpha Insights Documentation

Docs Navigation

Filter: wpd_woocommerce_currency_symbol

Modify currency symbols used in Alpha Insights price displays.

Description

This filter allows you to customize or replace currency symbols for specific currencies. Useful for displaying custom symbols, adding regional variations, or supporting cryptocurrencies and custom currency codes.

Location

File: includes/functions/wpd-currency-functions.php

Function: wpd_get_woocommerce_currency_symbol()

Line: ~446

Parameters

Parameter Type Description
$currency_symbol string The currency symbol for the given currency code
$currency string The three-letter currency code (e.g., ‘USD’, ‘EUR’, ‘GBP’)

Return

Type: string

Description: Modified currency symbol

Example Usage

Add Cryptocurrency Symbols

add_filter( 'wpd_woocommerce_currency_symbol', 'add_crypto_symbols', 10, 2 );
function add_crypto_symbols( $symbol, $currency )
{
    $crypto_symbols = array(
        'BTC' => '₿',
        'ETH' => 'Ξ',
        'LTC' => 'Ł',
        'USDT' => '₮',
        'DOGE' => 'Ð'
    );
    if ( isset( $crypto_symbols[$currency] ) )
    {
        return $crypto_symbols[$currency];
    }
    return $symbol;
}

Use Currency Code Instead of Symbol

add_filter( 'wpd_woocommerce_currency_symbol', 'use_currency_code', 10, 2 );
function use_currency_code( $symbol, $currency )
{
    // Display currency code (USD, EUR) instead of symbol ($, €)
    return $currency;
}

Custom Symbol for Specific Currency

add_filter( 'wpd_woocommerce_currency_symbol', 'custom_usd_symbol', 10, 2 );
function custom_usd_symbol( $symbol, $currency )
{
    // Use "USD $" instead of just "$"
    if ( $currency === 'USD' )
    {
        return 'USD $';
    }
    // Use custom Euro symbol
    if ( $currency === 'EUR' )
    {
        return 'EUR €';
    }
    return $symbol;
}

Regional Currency Variations

add_filter( 'wpd_woocommerce_currency_symbol', 'regional_symbols', 10, 2 );
function regional_symbols( $symbol, $currency )
{
    // Different dollar symbol for different regions
    $dollar_currencies = array( 'USD', 'CAD', 'AUD', 'NZD', 'SGD' );
    if ( in_array( $currency, $dollar_currencies ) )
    {
        // Show which dollar it is
        return $currency . ' $';
    }
    return $symbol;
}

Custom Internal Currency

add_filter( 'wpd_woocommerce_currency_symbol', 'custom_currency', 10, 2 );
function custom_currency( $symbol, $currency )
{
    // Add support for custom internal currency
    if ( $currency === 'CREDITS' )
    {
        return 'CR';
    }
    if ( $currency === 'POINTS' )
    {
        return 'P';
    }
    return $symbol;
}

HTML-Enhanced Symbols

add_filter( 'wpd_woocommerce_currency_symbol', 'html_symbols', 10, 2 );
function html_symbols( $symbol, $currency )
{
    // Add styling or icons to symbols
    if ( $currency === 'USD' )
    {
        return '$';
    }
    if ( $currency === 'EUR' )
    {
        return '';
    }
    return $symbol;
}

Multi-Currency Store Symbol Prefix

add_filter( 'wpd_woocommerce_currency_symbol', 'prefix_all_symbols', 10, 2 );
function prefix_all_symbols( $symbol, $currency )
{
    // In multi-currency stores, always show currency code
    $store_currencies = get_option( 'active_currencies', array( 'USD' ) );
    if ( count( $store_currencies ) > 1 )
    {
        return $currency . ' ' . $symbol;
    }
    return $symbol;
}

Context-Aware Symbols

add_filter( 'wpd_woocommerce_currency_symbol', 'context_aware_symbol', 10, 2 );
function context_aware_symbol( $symbol, $currency )
{
    // In reports, use abbreviated symbol
    if ( isset( $_GET['page'] ) && strpos( $_GET['page'], 'reports' ) !== false )
    {
        $abbreviated = array(
            'USD' => '$',
            'EUR' => '€',
            'GBP' => '£',
            'JPY' => '¥'
        );
        return isset( $abbreviated[$currency] ) ? $abbreviated[$currency] : $currency;
    }
    return $symbol;
}

Best Practices

  • Always return a string value
  • Keep symbols short (1-3 characters ideally)
  • Test with RTL languages if using directional symbols
  • Consider how symbols display at different sizes
  • Ensure symbols are distinguishable from each other
  • Use standard Unicode symbols when available

Important Notes

  • This affects Alpha Insights displays only (not WooCommerce checkout)
  • Symbol must be UTF-8 compatible
  • HTML is allowed but use sparingly for performance
  • Empty string will hide the symbol
  • Filter runs every time a price is formatted

Default Supported Currencies

Alpha Insights inherits currency symbols from WooCommerce, including:

  • USD – $ (US Dollar)
  • EUR – € (Euro)
  • GBP – £ (British Pound)
  • JPY – ¥ (Japanese Yen)
  • AUD – $ (Australian Dollar)
  • CAD – $ (Canadian Dollar)
  • CHF – CHF (Swiss Franc)
  • …and 100+ more currencies

Currency Code Format

Currency codes follow ISO 4217 standard:

  • Always 3 uppercase letters
  • First 2 letters = country code
  • Last letter = currency name
  • Example: USD (US Dollar), EUR (Euro), JPY (Japanese Yen)

Unicode Symbols

Common currency symbols and their Unicode:

$   U+0024   Dollar
€   U+20AC   Euro
£   U+00A3   Pound
¥   U+00A5   Yen
₹   U+20B9   Indian Rupee
₽   U+20BD   Russian Ruble
₿   U+20BF   Bitcoin
₺   U+20BA   Turkish Lira
₴   U+20B4   Ukrainian Hryvnia
₱   U+20B1   Philippine Peso

CSS Styling

/* Style currency symbols */
.currency-usd {
    color: #28a745;
    font-weight: 600;
}
.currency-eur {
    color: #0066cc;
    font-weight: 600;
}
.woocommerce-Price-currencySymbol {
    font-weight: normal;
    opacity: 0.8;
}

Debugging

add_filter( 'wpd_woocommerce_currency_symbol', 'debug_currency_symbol', 999, 2 );
function debug_currency_symbol( $symbol, $currency )
{
    error_log( sprintf( 
        'Currency: %s | Symbol: %s', 
        $currency, 
        $symbol 
    ));
    return $symbol;
}

Related Filters

  • wpd_price – Modify complete price HTML output
  • woocommerce_currency_symbols – Modify base currency symbol array

Related Functions

  • wpd_get_woocommerce_currency_symbol( $currency ) – Get currency symbol
  • wpd_get_store_currency() – Get store’s default currency
  • wpd_store_price( $price, $args ) – Format price for display

Got A Question?

Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
Alpha Insights

Alpha Insights

The World's Most Advanced WooCommerce Drag & Drop Report Builder.

5/5 – Trustpilot

Alpha Insights