Disable Unused Payment Gateways
-
Is it possible via a hook to disable unused payment gateways? We use the following code to disable woocommerce default payment gateways that are not used. I have tried using the objects used by your plugin but am not able to disable them with this process.
add_filter( ‘woocommerce_payment_gateways’, ‘custom_remove_unused_payment_gateways’, 20, 1 );
/**
* This function will remove all of the WooCommerce standard gateways from the
* WooCommerce > Settings > Checkout dashboard.
*/
function custom_remove_unused_payment_gateways( $load_gateways ) {
$remove_gateways = array(
‘WC_Gateway_Cheque’,
‘WC_Gateway_COD’,
‘WC_Gateway_Paypal’,
‘WC_Gateway_Simplify_Commerce’,
‘WC_Addons_Gateway_Simplify_Commerce’
);
foreach ( $load_gateways as $key => $value ) {
if ( in_array( $value, $remove_gateways ) ) {
unset( $load_gateways[ $key ] );
}
}
return $load_gateways;
}
- The topic ‘Disable Unused Payment Gateways’ is closed to new replies.