Manipulate Deliveries Shipment List


Available Hooks

“wpcvr_table_header_label” is an action hook used to add table header in the deliveries table.

“wpcvr_table_data_value” is an action hook used to add data or value to columns in the deliveries table.

Remove Deliveries Table Column

Copy and paste the following code in functions.php of your current theme.

            //#In this example, Total Distance and Driving Distance is removed.

            //remove table header
            remove_action( 'wpcvr_table_header_label', 'wpcvr_delivery_data_col_header' );

            //add tabe header without Total Distance and Driving Distance
            function wpccustom_deliveries_table_header(){
                ob_start();
                ?>
                <th class="no-space"><?php esc_html_e( 'Origin', 'wpcargo-vehicle-rate' ); ?></th>
                <th class="no-space"><?php esc_html_e( 'Destination', 'wpcargo-vehicle-rate' ); ?></th>
                <th class="no-space"><?php esc_html_e( 'Vehicle', 'wpcargo-vehicle-rate' ); ?></th>
                <th class="no-space"><?php esc_html_e( 'Delivery Charge', 'wpcargo-vehicle-rate' ); ?></th>
                <?php
                echo ob_get_clean();
            }
            add_action( 'wpcvr_table_header_label', 'wpccustom_deliveries_table_header', 1 );

            //#Remove table data for Total Distance and Driving Distance
            remove_action( 'wpcvr_table_data_value', 'wpcvr_delivery_data_col_data' );

            //#adding table data without Total Distance and Driving Distance
            function wpccustom_deliveries_table_data(  $shipment_id ){
                ob_start();
                $delivery_data  = get_post_meta( $shipment_id, 'delivery_data', true );
                $rate_id 		= $delivery_data['wpcvr_id']['value'];
                $rate_label 	= get_wpcvr_rate_label( $rate_id );
                ?>
                <td><?php echo $delivery_data['origin']['value'] ?></td>
                <td><?php echo $delivery_data['destination']['value'] ?></td>
                <td><?php echo $rate_label; ?></td>
                <td><?php echo wpcvr_currency_symbol().$delivery_data['delivery-charge']['value'] ?></td>
                <?php
                echo ob_get_clean();
            }
            add_action( 'wpcvr_table_data_value', 'wpccustom_deliveries_table_data', 1 );

            //#Remove print action column
            remove_action( 'wpcvr_table_header_label', 'wpcvr_delivery_print_col_header' );
            remove_action( 'wpcvr_table_data_value', 'wpcvr_delivery_print_col_data' );
        

Add Deliveries Table Column

Copy and paste the following code in functions.php of your current theme.

            //#In this example, we add shipper name to the deliveries column.
            function wpccuston_shipper_name_column(){
                ob_start();
                ?>
                <th class="no-space"><?php esc_html_e( 'Shipper Name', 'wpcargo-vehicle-rate' ); ?></th>
                <?php
                echo ob_get_clean();
            }
            add_action( 'wpcvr_table_header_label', 'wpccuston_shipper_name_column', 2 );

            //# Shipper Name data in the deliveries table
            function wpccustom_shipper_name_table_data(  $shipment_id ){
                ob_start();
                $shipper_name  = get_post_meta( $shipment_id, 'wpcargo_shipper_name', true );
                ?>
                <td><?php echo $shipper_name ?></td>
                <?php
                echo ob_get_clean();
            }
            add_action( 'wpcvr_table_data_value', 'wpccustom_shipper_name_table_data', 2 );
       

0
    0
    Your Cart
    Your cart is emptyReturn to Shop