How to customize assign shipment template
Customizing assign shipment template in Frontend Dashboard is possible through action hooks
Note: This is introduce in Frontend Manager Add on version 5.2.4 and up.
The following snippets on how to remove specific field in assign shipment template
// Remove Assign Client field 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 ); // Remove Assign Agent field remove_action( 'wpcfe_assign_form_content', 'wpcfe_assign_agent_callback', 10, 1 ); remove_action( 'wpcfe_bulk_assign_form_content', 'wpcfe_assign_agent_callback', 10, 1 ); // Remove Assign Employee field remove_action( 'wpcfe_assign_form_content', 'wpcfe_assign_employee_callback', 10, 1 ); remove_action( 'wpcfe_bulk_assign_form_content', 'wpcfe_assign_employee_callback', 10, 1 ); // Remove Assign Branch Manager remove_action( 'wpcfe_after_designation_dropdown', 'assign_branch_manager_dropdown' ); // Remove Asign Company Branch remove_action( 'before_wpcfe_shipment_form_submit', 'wpcbm_assigned_branch', 10, 2 ); // Remove Assign Driver Field add_action('init', function(){ remove_action( 'wpcfe_after_designation_dropdown', 'wpcargo_pod_assign_driver_dropdown' ); remove_action( 'after_wpcfe_bulk_update_form_fields', 'wpcargo_pod_wpcfe_bulk_update_form_fields' ); }, 999);
The following snippets on how to add additional fields in assign shipment template
// Add Custom field to the template // Note: In this sample code the metakey is - my_custom_meta function my_custom_field_callback( $shipment_id ){ ?> <div class="form-group"> <label for="my_custom_meta" class="active">Custom Field</label> <input class="form-control" type="text" name="my_custom_meta" value="<?php echo get_post_meta( $shipment_id, 'my_custom_meta', true); ?>" placeholder="My Custom Field"> </div> <?php } add_action( 'wpcfe_assign_form_content', 'my_custom_field_callback', 10, 1); add_action( 'wpcfe_bulk_assign_form_content', 'my_custom_field_callback', 10, 1); // Save the custom metakey data function save_my_custom_field_callback( $shipment_id, $data ){ // Check id my_custom_meta is submitted if( isset( $data['my_custom_meta'] ) ){ // save my_custom_meta value update_post_meta( $shipment_id, 'my_custom_meta', sanitize_text_field( $data['my_custom_meta'] ) ); } } add_action( 'wpcfe_assigned_shipment_save', 'save_my_custom_field_callback', 10, 2 );
OUTPUT: