Quantcast
Channel: WordPress.org Forums » [WooCommerce] Support
Viewing all articles
Browse latest Browse all 102102

solagirl on "[Plugin: WooCommerce - excelling eCommerce] The currency symbol for China Yuan is incorrect"

$
0
0

The code I provided earlier was found a bug, it does not work when there are more than one product in the cart. So here is an updated version. It takes care the condition of multiple products and converts shipping cost.

add_filter('woocommerce_paypal_args', 'convert_rmb_to_usd');
function convert_rmb_to_usd($paypal_args){
    if ( $paypal_args['currency_code'] == 'RMB'){
        $convert_rate = 6.2116; //Set converting rate
        $count = 1;
        while( isset($paypal_args['amount_' . $count]) ){
            $paypal_args['amount_' . $count] = round( $paypal_args['amount_' . $count] / $convert_rate, 2);
            $count++;
        }
    }
    return $paypal_args;
}

Viewing all articles
Browse latest Browse all 102102

Trending Articles