Support » Plugin: WooCommerce Currency Switcher » force currency on checkout

  • Resolved rfmizo

    (@rfmizo)


    Hello
    I have 2 currencies on my website
    Default Store currency is USD second is EURO
    i want to show usd on all products but EURO on checkout
    tried this code from your website

    add_filter('wp_head',function(){    
        if(is_checkout()){
            global $WOOCS;
            $WOOCS->set_currency('EUR');
        }
    });

    but did not work it apply EUR currency to all the website not only checkout

    also tried this

    add_action(‘wp_head’, ‘my_example_scripts’) ;
    function my_example_scripts(){
    if (class_exists(‘WOOCS’))
    {
    global $WOOCS;
    if (is_checkout() OR is_checkout_pay_page())
    {
    $WOOCS->current_currency=’EUR’;
    $WOOCS->storage->set_val(‘woocs_current_currency’,’EUR’);
    }
    }
    }
    
    

    thank you

    • This topic was modified 1 month ago by  rfmizo.
    • This topic was modified 1 month ago by  rfmizo.
Viewing 2 replies - 1 through 2 (of 2 total)
  • pavloborysenko

    (@pavloborysenko)

    Hello

    Try it:

    add_filter('wp_head',function(){    
        if(is_checkout()){
            global $WOOCS;
            $WOOCS->set_currency('EUR');
        }else{
    $WOOCS->set_currency('USD');
    }
    });
    Plugin Author PluginUs.NET

    (@realmag777)

    add_filter('wp_head',function(){    
        global $WOOCS;
        if(is_checkout()){        
            $WOOCS->set_currency('EUR');
        }else{
           $WOOCS->set_currency('USD');
         }
    });
Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.