• Resolved anncranium

    (@anncranium)


    Hi,

    Currently, we have products that are in pounds sterling currency but when the client starts to process the payment on the 2checkout payment page, it is still have the same amount but it is in Dirhams. It is okay for us to accept payments in Dirhams but we want it to automatically convert the pounds sterling to dirhams once they start making the payments.

    For example, the product is £60.00. But when the proceed to Checkout it becomes AED60. But it should be AED 330.

    Looking forward with your support.

    https://wordpress.org/plugins/woocommerce-2checkout-payment/

Viewing 3 replies - 1 through 3 (of 3 total)
  • sobeshirts

    (@sobeshirts)

    I am having the same problem. My 2Checkout account is AED and my site converts the currency based on the visitors location. However when you go to pay it will convert the currency without converting the actual value.

    Your website, plugin etc for 2Checkout needs to pass the “currency_code” parameter to 2Co for it to change the currency.

    https://www.2checkout.com/documentation/checkout/parameters

    I only had this problem today, i am hoping the developers can help us out with this.

    Plugin Author N-Media

    (@nmedia)

    Hi,

    we have just updated plugin to version 1.7 with this feature added.

    Hi,
    The problem is that 2co does not support my local currency but my store currency has to be local, the simple way out is to convert the unsupported currency into supported currency at the time of checkout. Is there is any way out ? to convert PKR (store Currency) to USD at checkout?

    i tried the following code but still its only converting PKR symbol to USD symbol the amount isn’t converting.

    Code in function.php :
    add_filter( ‘woocommerce_currencies’, ‘add_pkr_currency’ );

    function add_pkr_currency( $currencies ) {
    $currencies[‘PKR’] = __( ‘Pakistani Rupee’, ‘woocommerce’ );
    return $currencies;
    }

    add_filter(‘woocommerce_currency_symbol’, ‘add_pkr_currency_symbol’, 10, 2);

    function add_pkr_currency_symbol( $currency_symbol, $currency ) {
    switch( $currency ) {
    case ‘PKR’: $currency_symbol = ‘PKR’; break;
    }
    return $currency_symbol;
    }

    /*conversion for 2checkout:*/

    add_filter( ‘woocommerce_twoco_supported_currencies’, ‘add_pkr_twoco_valid_currency’ );
    function add_pkr_twoco_valid_currency( $currencies ) {
    array_push ( $currencies , ‘PKR’ );
    return $currencies;
    }
    /*Step 3 – Code to change ‘PKR’ currency to ‘USD’ before checking out with 2co through Woocommerce:*/

    add_filter(‘woocommerce_twoco_args’, ‘convert_pkr_to_usd’);
    function get_currency($from_Currency=’USD’, $to_Currency=’PKR’) {
    $url = “http://www.google.com/finance/converter?a=1&from=$from_Currency&to=$to_Currency”;

    $ch = curl_init();
    $timeout = 0;
    curl_setopt ($ch, CURLOPT_URL, $url);
    curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);

    curl_setopt ($ch, CURLOPT_USERAGENT,
    “Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1)”);
    curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
    $rawdata = curl_exec($ch);
    curl_close($ch);
    $data = explode(‘bld>’, $rawdata);
    $data = explode($to_Currency, $data[1]);

    return round($data[0], 2);
    }

    function convert_pkr_to_usd($twoco_args){
    if ( $twoco_args[‘currency_code’] == ‘PKR’){
    $convert_rate = get_currency(); //Set converting rate
    $twoco_args[‘currency_code’] = ‘USD’; //change PKR to USD
    $i = 1;

    while (isset($twoco_args[‘amount_’ . $i])) {
    $twoco_args[‘amount_’ . $i] = round( $twoco_args[‘amount_’ . $i] / $convert_rate, 2);
    ++$i;
    }

    if ( $twoco_args[‘discount_amount_cart’] > 0 ) {
    $twoco_args[‘discount_amount_cart’] = round( $twoco_args[‘discount_amount_cart’] / $convert_rate, 2);
    }
    }

    return $twoco_args;
    }

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Currency’ is closed to new replies.