• Resolved Alin Ionut

    (@c3dry2k)


    My store runs on English and Romanian, An as you expected I have for English € currency and for Romanian lei.
    On English version everything is smooth, but on Romanian with lei, I can’t checkout with Paypal, because Paypal doesn’t support Romanian currency. It is possible to be able to checkout with Paypal but with default currency, which is € in my case?
    Look forward to see this featured implemented.

    https://www.ads-software.com/plugins/woocommerce-multilingual/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hello, you can try with this code as a workaround.

    function geo_client_currency($client_currency){
    if(ICL_LANGUAGE_CODE == 'en'){
        $client_currency = 'EUR'; //currency code
        return $client_currency;
    } elseif(ICL_LANGUAGE_CODE == 'ro'){
    if( is_checkout() ) {
        $client_currency = 'EUR'; //currency code
        return $client_currency;
    } elseif(is_product() || is_shop() || is_woocommerce() || is_cart() ) {
        $client_currency = 'LEU'; //currency code
        return $client_currency;
    }
    }
    }
    
    add_filter('wcml_client_currency','geo_client_currency');

    This should change the currency while on checkout page in your second language. Please remember that you need to enable the Euro currency for the second language (Romanian in your case) in order for this to work.

    Thread Starter Alin Ionut

    (@c3dry2k)

    Thank you George, but this I already accomplish.

    I need to checkout only on Paypal with euro, other checkout options must remain in Romanian currency (lei).

    Right now on Romanian with Lei, the checkout with Paypal option is gone, because, as you know, Paypal do not support Romanian currency (lei).

    Perhaps this would be possible if first you add your currency to the supported currency list in order to display the PayPal gateway for your currency:

    add_filter( 'woocommerce_paypal_supported_currencies', 'add_paypal_valid_currency' );
    function add_paypal_valid_currency( $currencies ) {
    array_push ( $currencies , 'LEU' ); /* YOUR CURRENCY */
    return $currencies;
    }

    and then switch currency:

    function geo_client_currency($client_currency){
    if(ICL_LANGUAGE_CODE == 'en'){
        $client_currency = 'EUR'; //currency code
        return $client_currency;
    } elseif(ICL_LANGUAGE_CODE == 'ro'){
    if( is_checkout() ) {
        $client_currency = 'EUR'; //currency code
        return $client_currency;
    } elseif(is_product() || is_shop() || is_woocommerce() || is_cart() ) {
        $client_currency = 'LEU'; //currency code
        return $client_currency;
    }
    }
    }
    
    add_filter('wcml_client_currency','geo_client_currency');
    
    function currency($paypal_args){
    $paypal_args['currency_code'] = 'EUR';
    return $paypal_args;
    add_filter('woocommerce_paypal_args', 'currency');

    I have not tested this, but I provide you this snippets as a guideline.
    If you wish, I can add this as a feature request that can be considered in the future. Please let me know.

    Thread Starter Alin Ionut

    (@c3dry2k)

    Your code put me the currency on checkout on Romanian in Euro. I do not want this, and as default, I do not have Paypal as checkout option.

    Thank you.

    The first snippet should add the possibility for your site to have the paypal checkout, but in the wrong currency. You need to modify slightly the second snippet to suit your needs after the paypal checkout method is selected.
    Then you need to modify the block where the currency is switchet to suit your needs, and then you need to use the last part of the code to send that currency as the paypal parameters by hooking to woocommerce_paypal_args.
    It is very complex process that needs some coding, and currently the code that I provided to you is only as a guideline, and not a complete solution.

    I am going to close this thread due to inactivity.
    The feature that you requested is added for consideration for future versions.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Checkout with paypal’ is closed to new replies.