Created
March 7, 2019 12:48
-
-
Save malsubrata/5828862250a6b5236188fd02bd9f3322 to your computer and use it in GitHub Desktop.
Disable all other payment gateways if not wallet rechargeable cart.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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