FOX - Professionnel du commutateur de devises WooCommerce

Changer de devise avec le changement de langue

WPML :

  • ouvert functions.php de votre thème wp actuel
  • déposez-y le prochain code PHP:
    add_filter('wp_head', function() { $lang = ICL_LANGUAGE_CODE; global $WOOCS; switch ($lang) { case 'bg': $WOOCS->set_currency('BGN'); break; case 'en': $WOOCS ->set_currency('EUR'); break; par défaut: $WOOCS->set_currency('USD'); break; } });
  • Voir la documentation WPML sur les codes de langues

Polylang et TranslatePress :

  • ouvrez functions.php de votre thème wp actuel
  • déposez-y le prochain code PHP:
    add_filter('wp_head', function() { $lang = get_locale(); global $WOOCS; switch ($lang) { case 'bg_BG' : $WOOCS->set_currency('BGN'); break ; case 'en_GB' : $WOOCS->set_currency('EUR'); pause ; valeur par défaut : $WOOCS->set_currency('USD'); pause ; } });
  • https://wordpress.org/support/topic/switch-currency-with-language-change-polylang/
  • Voir la documentation Polylang sur les codes de langues

GTraduire :

  • ouvert functions.php de votre thème wp actuel
  • déposez-y le prochain code PHP:
    add_filter('wp_head', function() { $lang = isset($_SERVER['HTTP_X_GT_LANG']) ? $_SERVER['HTTP_X_GT_LANG'] : ''; global $WOOCS; switch ($lang) { case 'bg_BG' : $WOOCS->set_currency('BGN'); break; case 'en_GB': $WOOCS->set_currency('EUR'); break; par défaut: $WOOCS->set_currency('USD'); break; } });
  • https://wordpress.org/plugins/gtranslate/

Intégration qTranslate X :

  • ouvert functions.php de votre thème wp actuel
  • déposez-y le prochain code PHP:
    add_action('wp_head', function () { if (function_exists('qtranxf_getLanguage') AND class_exists('WOOCS')) { $lang = qtranxf_getLanguage(); global $WOOCS; switch ($lang) { case 'bg' : $ WOOCS->set_currency('BGN'); break; case 'en': $WOOCS->set_currency('EUR'); break; par défaut: $WOOCS->set_currency('USD'); break; } } });