Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save KresimirKoncicNeuralab/836f3a9dee4ea1c13864 to your computer and use it in GitHub Desktop.
Save KresimirKoncicNeuralab/836f3a9dee4ea1c13864 to your computer and use it in GitHub Desktop.
add_filter('woocommerce_paypal_args', 'convert_hrk_to_eur');
function convert_hrk_to_eur($paypal_args)
{
if ( $paypal_args['currency_code'] == 'HRK')
{
$convert_rate = 7.5; //set the converting rate or pull form the DB transients
$paypal_args['currency_code'] = 'EUR'; //change HRK to EUR
$i = 1;
while (isset($paypal_args['amount_' . $i]))
{
$paypal_args['amount_' . $i] = round( $paypal_args['amount_' . $i] / $convert_rate, 2);
++$i;
}
}
return $paypal_args;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment