Allow other user role to access invoices

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Allow Agent to access invoices
add_filter( 'can_wpcinvoice_access', 'custom_can_wpcinvoice_access' , 10 ,1);
function custom_can_wpcinvoice_access( $roles ){
    $roles = (array)$roles;
    $roles[] = 'cargo_agent';
      
    return $roles;
}
 
// Allow Agent to access invoices multiple package
add_filter( 'can_wpcinvoice_access_package', 'custom_can_wpcinvoice_access_package' , 10 ,1);
function custom_can_wpcinvoice_access_package( $roles ){
    $roles = (array)$roles;
    $roles[] = 'cargo_agent';
       
    return $roles;
}
 
// Allow Agent to update invoice
add_filter( 'can_wpcfe_update_shipment', 'custom_can_wpcfe_update_shipment' , 10 ,1);
function custom_can_wpcfe_update_shipment( $roles ){
    $roles = (array)$roles;
    $roles[] = 'cargo_agent';
       
    return $roles;
}