Remove view shipment column in shipment table by roles

Note: Please copy and paste this code in functions.php of your current theme.

  function remove_view_shipment_callback(){
    $current_user = wp_get_current_user();
    /*
    * WPCargo Roles
    */

    /* 
    * wpcargo_client
    * wpcargo_pending_client
    * wpcargo_employee
    * cargo_agent
    */

    // Remove View Shipment Column from the shipment table
    if( in_array( "wpcargo_client", $current_user->roles ) ){
      remove_action( 'wpcfe_shipment_table_header', 'wpcfe_shipment_table_header_view', 25 );
      remove_action( 'wpcfe_shipment_table_data','wpcfe_shipment_table_data_view', 25 );
    }
      
  }
  add_action( 'init', 'remove_view_shipment_callback' );
  
0
    0
    Your Cart
    Your cart is emptyReturn to Shop