FOX - Currency Switcher for WooCommerce

woocs_price_html

Le hook woocs_price_html vous permet de personnaliser l'affichage du prix des produits. Cela est utile pour ajouter des symboles de devise personnalisés, des images ou modifier le code HTML du prix. Exemple d'utilisation : Remplacez le code de devise standard par un symbole d'image personnalisé :
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);
Paramètres :
  • $price_html (string) - Le code HTML du prix formaté à afficher
Retourne :
  • (string) Code HTML du prix modifié
Note : Ajoutez ce code dans le fichier functions.php de votre thème ou dans un plugin personnalisé.