Woocommerce Filter :
woocommerce_available_payment_gateways
filter provides all active payment gateways list on checkout page. And there you can find gateway name that you want to disable.add_filter('woocommerce_available_payment_gateways','show_active_gateways',1); function show_active_gateways($gateways){ global $woocommerce; // unset payment gateway unset($gateways['paypal']); return $gateways; }
$gateways
variable by using print_r()
function.To remove this payment gateway we have used unset() function provided by php it self. This function expects key from array that we want to remove so ultimately its removing key and value both from array.
By this way, we can remove payment gateway programmatically using woocommerce filter. Thanks.
0 Comments
If you have any doubts, please mention in comment or if you want to discuss privately then please use this email : codetrycatch@gmail.com.
We will definitely try to contact you. Thanks.