Paypal and multiple currencies
-
Hello Sir,
Please can you help?My problem is this:
I used this code to add my currency to the store, as it was not there”
/* Add any custom PHP below this line of text / add_filter( ‘woocommerce_currencies’, ‘add_my_currency’ ); function add_my_currency( $currencies ) { $currencies['ABC'] = __( 'Kuwaiti Dinar', 'woocommerce' ); return $currencies; } add_filter(‘woocommerce_currency_symbol’, ‘add_my_currency_symbol’, 10, 2); function add_my_currency_symbol( $currency_symbol, $currency ) { switch( $currency ) { case 'ABC': $currency_symbol = 'KD'; break; } return $currency_symbol; }
then i added this so paypal will convet my local KWD to USD
add_filter( ‘woocommerce_paypal_supported_currencies’, ‘add_aed_paypal_valid_currency’ ); function add_aed_paypal_valid_currency( $currencies ) { array_push ( $currencies , ‘ABC’ ); / YOUR CURRENCY */ return $currencies; } function convert_aed_to_usd($paypal_args){ if ( $paypal_args[‘currency_code’] == ‘ABC’){ $convert_rate = 0.3; //set the converting rate $paypal_args[‘currency_code’] = ‘USD’; //change ABC to USD $i = 1; while (isset($paypal_args['amount_' . $i])) { $paypal_args['amount_' . $i] = round( $paypal_args['amount_' . $i] / $convert_rate, 2); ++$i; } if ( $paypal_args['discount_amount_cart'] > 0 ) { $paypal_args['discount_amount_cart'] = round( $paypal_args['discount_amount_cart'] / $convert_rate, 2); } } return $paypal_args; }
Then i used Currency Switcher plugin
https://codecanyon.net/item/woocommerce-currency-switcher/8085217And paypal stopped working as I believe the plugin override the code i added above.
If I used ur plugin will it solve this issue? can i add a code that converts my currencies (5 currencies as our local KWD has its own payment gaetway but the reason i added above code is paypal will not be active if main currency of the site is not supported by it) to USD for paypal to work?
I want to show different currencies and pay in US dollar at the end as its the only supported currency among the ones we used
https://darhaa.com/start/en/shop/
Please advice
Thank you so much!
https://www.ads-software.com/plugins/paypal-for-woocommerce/
- The topic ‘Paypal and multiple currencies’ is closed to new replies.