• Resolved Dharmesh Patel

    (@dharm1025)


    Hello there,

    Thanks for the great plugin. I want to display amount in user selected currency on checkout page. I know there is option for allowed multiple but it forces to make payment in user selected currency. I just wanted to display user selected currency on checkout page for information purpose. payment should me made in default currency.

    I have done some research to achieve this but not found any easy way. finally I wrote a code for achieve this. code is given below.

    add_filter( "option_woocs_is_multiple_allowed", "alter_option_woocs_is_multiple_allowed", 10, 2 );
    function alter_option_woocs_is_multiple_allowed( $value, $option ){
        if( is_checkout_pay_page() ){
            return $value;
        }
        return true;
    }

    So, my question is that, is there any other way to achieve this? and if I use above code then any chances to get conflict with plugin’s functionality? its working fine currently I just want to confirm it will not create any issue in future.

    Thanks,
    Dharmesh

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello Dharmesh

    yes it can cause a problem.

    because different hooks are used to convert the price

    Try reset currencies – https://currency-switcher.com/function/woocs-reset_currency/

    Thread Starter Dharmesh Patel

    (@dharm1025)

    Hello @pavloborysenko,

    Thanks for the super fast reply.

    Yes, I know this hook is not used for convert price. I just don’t wanted reset currency on checkout page and want to reset currency in after process of checkout. so I have keep multiple allowed till check out. and then added these actions for reset currency.

    add_action( 'wp_head', 'custom_reset_currency_wp_head', 999 );
    function custom_reset_currency_wp_head(){
        global $WOOCS;
        if ( is_checkout_pay_page() ) {
            $WOOCS->reset_currency();
        }
    }
    add_action('woocommerce_checkout_process', 'custom_check_currency_on_checkout', 1 );
    function custom_check_currency_on_checkout() {
        global $WOOCS;
        $curr_curr = $WOOCS->default_currency;
        $WOOCS->current_currency = $curr_curr;
        $WOOCS->storage->set_val('woocs_current_currency', $curr_curr);
    }

    is it fine?

    Thanks,
    Dharmesh

    Hello Dharmesh

    Yes. I think this is the more correct way

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘User Selected currency on Checkout page.’ is closed to new replies.