How To Remove Package Fields From Specific User Roles
Copy and paste this code to your active theme’s functions.php file:
function wpcfe_custom_remove_package_fields() { if( !is_user_logged_in() ) { return; } // abort execution if user is not logged in $user = wp_get_current_user(); // get current user data $roles = $user->roles ?: array(); // get current user role if( in_array( 'wpcargo_client', $roles ) ) { // if current user role is wpcargo_client, remove package fields remove_action( 'after_wpcfe_shipment_form_fields', 'wpcfe_shipment_multipackage_template', 10, 1 ); } } add_action( 'wp_head', 'wpcfe_custom_remove_package_fields', 11 );