add_filter( 'woocommerce_available_payment_gateways', 'hide_payment_gateway' ); function hide_payment_gateway( $available_gateways ) { global $woocommerce; if ( isset( $available_gateways['cod'] ) && !current_user_can('administrator') && !current_user_can('staff') && !current_user_can('editor') ) { unset( $available_gateways['cod'] ); } return $available_gateways; }
Author: Wojciech Borowicz
I hope this post will help you to do what you need.
In case you want some assistance click here to get in touch