Skip to content

Instantly share code, notes, and snippets.

@malsubrata
Created March 7, 2019 12:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save malsubrata/5828862250a6b5236188fd02bd9f3322 to your computer and use it in GitHub Desktop.
Save malsubrata/5828862250a6b5236188fd02bd9f3322 to your computer and use it in GitHub Desktop.
Disable all other payment gateways if not wallet rechargeable cart.
if(!function_exists('woocommerce_available_payment_gateways_callback')){
function woocommerce_available_payment_gateways_callback($_available_gateways){
if(!is_admin() && !is_wallet_rechargeable_cart()){
foreach ($_available_gateways as $id => $gateway){
if('wallet' != $id){
unset($_available_gateways[$id]);
}
}
}
return $_available_gateways;
}
}
add_filter('woocommerce_available_payment_gateways', 'woocommerce_available_payment_gateways_callback');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment