I want to add an option in checkout page to select the currency for payment ( USD or INR ) and based on that display the payment gateway option ( PAYPAL if USD or PAYUMONEY if INR and grey out the other option. I'm totally new to coding.
0
votes
1 Answers
3
votes
I solved this:
function woocs_filter_gateways($gateway_list)
{
global $WOOCS;
$exclude = array(
'paypal' => array('INR'), //do not show paypal gate if current currency is INR
'payuindia' => array('USD')//do not show payumoney gate if current currency is USD
);
//***
foreach ($exclude as $gateway_key => $currencies)
{
if (isset($gateway_list[$gateway_key]) AND in_array($WOOCS->current_currency, $currencies))
{
unset($gateway_list[$gateway_key]);
}
}
return $gateway_list;
}