How To Remove User Assignment Sections From Receiving Page

Code goes to your active theme’s functions.php file:


function wpcrcustom_remove_user_assignment_sections(){
    // get current user roles
    $current_user = wp_get_current_user();
    $user_roles = $current_user->roles;

    // remove assignment sections from employee
    if(in_array('wpcargo_employee', $user_roles)){
        // remove assign client section
        remove_action( 'wpcr_after_receiving_form_fields', 'wpcr_client_receiving_form_fields' );
        // remove assign agent section
        remove_action( 'wpcr_after_receiving_form_fields', 'wpcr_agent_receiving_form_fields' );
        // remove assign employee section
        remove_action( 'wpcr_after_receiving_form_fields', 'wpcr_employee_receiving_form_fields' );
        // remove assign driver section
        remove_action( 'wpcr_after_receiving_form_fields', 'wpcr_pod_receiving_form_fields' );
    }
}
add_action('init', 'wpcrcustom_remove_user_assignment_sections', 20);

Before hook application:

After hook application:

0
    0
    Your Cart
    Your cart is emptyReturn to Shop