• Resolved alexprs7

    (@alexprs7)


    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 2 years, 11 months ago by alexprs7.
    • This topic was modified 2 years, 11 months ago by alexprs7.
    • This topic was modified 2 years, 11 months ago by alexprs7.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support mediawebster

    (@mediawebster)

    Hello Alex

    Where did you add this code? Please drop me screenshots

    And drop me Text of the error

    Thread Starter alexprs7

    (@alexprs7)

    Hi,

    Thank you for your answer.
    Here is where I added the code:
    Public_html> WP CONTENT> theme> function.Php

    Please find a screenshot of the code and the error

    View post on imgur.com

    Thank you
    Alex

    • This reply was modified 2 years, 11 months ago by alexprs7.
    Thread Starter alexprs7

    (@alexprs7)

    Text of Error

    The REST API encountered an unexpected resultPerformance
    The REST API is one way WordPress, and other applications, communicate with the server. One example is the block editor screen, which relies on this to display, and save, your posts and pages.
    The REST API call gave the following unexpected result: (500) <!DOCTYPE html> <html lang=”fr-FR” data-container=”1440″ data-xl=”2″ data-admin-bar=”1″> <head> <meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″ /> <meta name=”viewport” content=”width=device-width”> <meta name=’robots’ content=’max-image-preview:large, noindex, follow’ /> <title>WordPress » Erreur</title> <style type=”text/css”> html { background: #f1f1f1; } body { background: #fff; border: 1px solid #ccd0d4; color: #444; font-family: -apple-system, BlinkMacSystemFont, “Segoe UI”, Roboto, Oxygen-Sans, Ubuntu, Cantarell, “Helvetica Neue”, sans-serif; margin: 2em auto; padding: 1em 2em; max-width: 700px; -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, .04); box-shadow: 0 1px 1px rgba(0, 0, 0, .04); } h1 { border-bottom: 1px solid #dadada; clear: both; color: #666; font-size: 24px; margin: 30px 0 0 0; padding: 0; padding-bottom: 7px; } #error-page { margin-top: 50px; } #error-page p, #error-page .wp-die-message { font-size: 14px; line-height: 1.5; margin: 25px 0 20px; } #error-page code { font-family: Consolas, Monaco, monospace; } ul li { margin-bottom: 10px; font-size: 14px ; } a { color: #0073aa; } a:hover, a:active { color: #006799; } a:focus { color: #124964; -webkit-box-shadow: 0 0 0 1px #5b9dd9, 0 0 2px 1px rgba(30, 140, 190, 0.8); box-shadow: 0 0 0 1px #5b9dd9, 0 0 2px 1px rgba(30, 140, 190, 0.8); outline: none; } .button { background: #f3f5f6; border: 1px solid #016087; color: #016087; display: inline-block; text-decoration: none; font-size: 13px; line-height: 2; height: 28px; margin: 0; padding: 0 10px 1px; cursor: pointer; -webkit-border-radius: 3px; -webkit-appearance: none; border-radius: 3px; white-space: nowrap; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; vertical-align: top; } .button.button-large { line-height: 2.30769231; min-height: 32px; padding: 0 12px; } .button:hover, .button:focus { background: #f1f1f1; } .button:focus { background: #f3f5f6; border-color: #007cba; -webkit-box-shadow: 0 0 0 1px #007cba; box-shadow: 0 0 0 1px #007cba; color: #016087; outline: 2px solid transparent; outline-offset: 0; } .button:active { background: #f3f5f6; border-color: #7e8993; -webkit-box-shadow: none; box-shadow: none; } </style> </head> <body id=”error-page”> <div class=”wp-die-message”><p>Il y a eu une erreur critique sur ce site.</p><p>Learn more about WordPress debugging.</p></div></body> </html> .

    Plugin Support mediawebster

    (@mediawebster)

    Hello

    You inserted the code incorrectly. please read this article carefully https://currency-switcher.com/switch-currency-with-language-change/

    If you cannot insert this code, ask a friend of the developer to do it

    Thread Starter alexprs7

    (@alexprs7)

    Hi, Thank you for your reply

    Plugin Support mediawebster

    (@mediawebster)

    Hello

    Welcome;)

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘I need help changing currency with TranslatePress language’ is closed to new replies.