How To Make Assigned Client Searchable

  • Remove the default assigned client section and load select 2 library via CDN
    Copy and paste this code:

    add_action( ‘wp_head’, function() {
      remove_action( ‘wpcfe_assign_form_content’, ‘wpcfe_assign_client_callback’, 10, 1 );
      remove_action( ‘wpcfe_bulk_assign_form_content’, ‘wpcfe_assign_client_callback’, 10, 1 );
      ?>
        <link href=”https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css” rel=”stylesheet” />
        <script src=”https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js”></script>
      <?php
    });
  • Add the new assigned client section
    Copy and paste this code:

    function jdl_wpcfe_assign_client_callback( $shipment_id ) {
      $wpcargo_client = wpcfe_get_users(‘wpcargo_client’);
        if( can_wpcfe_assign_client() ): ?>
          <div class=”form-group”>
              <div class=”select-no-margin”>
                  <label><?php esc_html_e(‘Client’,’wpcargo-frontend-manager’); ?></label>
                  <select name=”registered_shipper” class=”mdb-select mt-0 form-control browser-default _custom_select” id=”registered_client” >
                      <option value=””><?php esc_html_e(‘– Select Client –‘,’wpcargo-frontend-manager’); ?></option>
                      <?php if( !empty( $wpcargo_client ) ): ?>
                          <?php foreach( $wpcargo_client as $key => $value ):  ?>
                              <option value=”<?php echo $key; ?>” <?php selected( get_post_meta( $shipment_id, ‘registered_shipper’, TRUE ), $key ); ?>><?php echo $value; ?></option>
                          <?php endforeach; ?>
                      <?php  endif; ?>
                  </select>
              </div>
          </div>
      <?php endif;
    }
    add_action( ‘wpcfe_assign_form_content’, ‘jdl_wpcfe_assign_client_callback’, 10, 1 );
    add_action( ‘wpcfe_bulk_assign_form_content’, ‘jdl_wpcfe_assign_client_callback’, 10, 1 );
6
    6
    Your Cart
    Remove
    Remove
    Remove
    WPCargo Vehicle Rate
    1 X $340.90 = $340.90
    Remove
    Remove
    WPCargo Parcel Quotation Package
    1 X $333.90 = $333.90
    Remove
    WPCargo Distance Rate
    1 X $69.00 = $69.00