Skip to content

Instantly share code, notes, and snippets.

@vikas5914
Created December 19, 2016 17:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vikas5914/b158589a1298f9c97c64f1564d54bbac to your computer and use it in GitHub Desktop.
Save vikas5914/b158589a1298f9c97c64f1564d54bbac to your computer and use it in GitHub Desktop.
function woocommerce_paypal_args_for_inr($paypal_args){
if ( $paypal_args['currency_code'] == 'currency_code'){
$convert_rate = currency_rate; // $1 = how much
$count = 1;
while( isset($paypal_args['amount_' . $count]) ){
$paypal_args['amount_' . $count] = round( $paypal_args['amount_' . $count] / $convert_rate, 2);
$count++;
}
if (isset($paypal_args['tax_cart'])) {
$paypal_args['tax_cart'] = round($paypal_args['tax_cart'] / $convert_rate, 2);
}
if (isset($paypal_args['shipping_1'])) {
$paypal_args['shipping_1'] = round($paypal_args['shipping_1'] / $convert_rate, 2);
}
}
return $paypal_args;
}
add_filter('woocommerce_paypal_args', 'woocommerce_paypal_args_for_inr');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment