Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 59525

I need help changing currency with TranslatePress language

$
0
0

Replies: 0

Hi

Hello I want to use your plugin which has it great and I use Translatepress and Elementor

I found the following code in a discussion, to change the currency depending on the language and I add it to fubction.php, indeed the currency has changed but I can no longer modify my website with Elementor

$lang=get_locale();
global $WOOCS;
switch($lang){
 case 'en_US':
      $WOOCS->current_currency='USD';
      $WOOCS->storage->set_val('woocs_current_currency', 'USD');
   break;
 case 'fr_FR':
      $WOOCS->current_currency='EUR';
      $WOOCS->storage->set_val('woocs_current_currency', 'EUR');
   break;
  default:
      $WOOCS->current_currency='EUR';
      $WOOCS->storage->set_val('woocs_current_currency', 'EUR');
  break;
}

I then integrated this code in order to connect Elementor

Résult :

if(class_exists(‘WOOCS’)){
//$lang = isset($_SERVER[‘HTTP_X_GT_LANG’]) ? $_SERVER[‘HTTP_X_GT_LANG’] : ”;
switch ($lang)
{
case ‘en_GB’:
alg_wc_cs_session_set( ‘alg_currency’, EUR );
break;
default:
alg_wc_cs_session_set( ‘alg_currency’, USD );
break;
}

But my site is now showing a critical error can you please help me by giving me the correct code

My original language French and my currency: Euro> I want to be able to change it and use the currency USD and the English language en_US

Thank you in avance,
Alex

  • This topic was modified 4 minutes ago by alexprs7.
  • This topic was modified 1 minute ago by alexprs7.
  • This topic was modified 14 seconds ago by alexprs7.

Viewing all articles
Browse latest Browse all 59525

Trending Articles