I have this code to disable/remove the payments tab from the WooCommerce settings tab, however, the users can still directly access the payments settings / payment methods using the direct url like wp-admin/admin.php?page=wc-settings&tab=checkout
add_filter( ‘woocommerce_settings_tabs_array’, ‘wd_remove_woocommerce_payment_tab’, 200, 1 );
function wd_remove_woocommerce_payment_tab( $tabs_array ) {
$wd_allowed_users = array("asd", "asd", "asd");
$wd_user = wp_get_current_user();
if ( in_array(strtolower($wd_user->user_login), $wd_allowed_users)){
**unset( $tabs_array['checkout'] ); **
}
return $tabs_array;
}
New contributor
Syed Tahir Rasul is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.