FOX - WooCommerce Currency Switcher Professional

woocs_price_html

The woocs_price_html hook allows you to customize the price display for products. This is useful for adding custom currency symbols, images, or modifying the price HTML output.

Usage Example:

Replace the standard currency code with a custom image symbol:

add_filter('woocs_price_html', function ($price_html) {
    global $WOOCS;
    if (isset($WOOCS) AND $WOOCS->current_currency === 'AED') {
        $image = '<img src="https://lightyellow-chicken-161714.hostingersite.com/wp-content/uploads/2026/01/aed-d.webp" alt="AED" style="display:inline-block; width:15px; height:15px; vertical-align:middle; margin: 0; padding: 0;" />';

        $price_html = str_replace('AED', $image, $price_html);
        $price_html = str_replace('د.إ', '', $price_html);
    }

    return $price_html;
}, 10, 1);

Parameters:

  • $price_html (string) – The formatted price HTML to be displayed

Returns:

  • (string) Modified price HTML

Note: Add this code to your theme’s functions.php file or a custom plugin.