FOX - WooCommerce Currency Switcher Professional

Custom Currency Code

WooCommerce 9.x implemented strict currency validation using ISO 4217 whitelist. XTR is not a standard ISO currency code, causing wc_create_order() to fail.

Technical Background

XTR (Telegram Stars) is a non-standard currency used within Telegram’s payment ecosystem. WooCommerce now validates all currency codes against the official ISO 4217 list before order creation.

Previous behavior (WooCommerce < 9.x): Any currency code was accepted
Current behavior (WooCommerce 9.x+): Only whitelisted ISO codes are valid

Register XTR as Valid Currency

File: functions.php (theme)

Code:

add_filter('woocommerce_currencies', function($currencies) {
    $currencies['XTR'] = __('Telegram Stars', 'woocommerce');
    return $currencies;
});

add_filter('woocommerce_currency_symbol', function($symbol, $currency) {
    if ($currency === 'XTR') {
        return '⭐';
    }
    return $symbol;
}, 10, 2);

Result: XTR becomes selectable in WooCommerce currency list.

The example disclosed in this article may apply to any non-existent currency