1. First off, make sure that you uncheck the “Enable Autogenerate Shipment Number?” on WPCargo -> General Settings.
2. We need to remove the default hook that displays the shipment number on the very top section when creating a shipment. Copy and paste this code on your active theme’s functions.php file.
remove_action( 'before_wpcfe_shipment_form_fields', 'wpcfe_shipment_title_field', 1 );
3. Lastly, recreate the hook. This is already the revised hook which allows clients to manually enter shipment numbers. Copy and paste this code on your active theme’s functions.php file:
function my_test_hook_callback( $shipment_id ){
global $wpcargo;
if( array_key_exists( 'wpcargo_title_prefix_action', $wpcargo->settings ) && !$shipment_id ){
return false;
}
if( ( array_key_exists( 'wpcargo_title_prefix_action', $wpcargo->settings ) && $shipment_id ) ){
?>
<div class="col-md-12 mb-3">
<div class="card">
<div class="card-header text-center">
<?php echo apply_filters( 'wpcfe_shipment_number_label', __('Shipment Number', 'wpcargo-frontend-manager' ) ); ?>
<h5><?php echo get_the_title( $shipment_id ); ?></h5>
</div>
</div>
</div>
<?php
return false;
}
$shipment_title = $shipment_id ? get_the_title( $shipment_id ) : '';
?>
<div id="shipment-number" class="col-md-12 mb-4">
<div class="card">
<div class="card-body">
<div class="col-auto p-0">
<!-- Default input -->
<label class="sr-only" for="wpcfe_shipment_title"><?php echo apply_filters( 'wpcfe_shipment_number_label', __( 'Shipment Number', 'wpcargo-frontend-manager' ) ); ?></label>
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text"><i class="fa fa-barcode mr-3"></i><?php echo apply_filters( 'wpcfe_shipment_number_label', __( 'Shipment Number', 'wpcargo-frontend-manager' ) ); ?></div>
</div>
<input type="text" class="form-control py-0" id="wpcfe_shipment_title" name="wpcfe_shipment_title" value="<?php echo $shipment_title; ?>" >
</div>
</div>
</div>
</div>
</div>
<?php
}
add_action('before_wpcfe_shipment_form_fields', 'my_test_hook_callback');