wpcargo_track_form

“wpcargo_track_form” action is used to change the track whole form template.

Copy and paste the following sample code to customize the track form template to the theme functions.php file


add_action( 'wp', function(){
	global $wpcargo_track_form;
    function my_custom_wpcargo_track_form( ){
        global $post;
        ?>
        <div class="wpcargo-track wpcargo wpcargo-col-md-12">
            <form method="post" name="wpcargo-track-form" style="display: flex; flex-wrap: nowrap; flex-direction: row; align-content: center; justify-content: space-evenly; margin-top: 36px;" action="<?php echo get_the_permalink( ); ?>" >
                <!-- Add nonce filter for form submission security -->
                <?php wp_nonce_field( 'wpcargo_track_shipment_action', 'track_shipment_nonce' ); ?>
                <!-- Note: The name for the form field number always "wpcargo_tracking_number" -->
                <p>
                    <input class="input_track_num" type="text" name="wpcargo_tracking_number" autocomplete="off" placeholder="Enter Tracking Number" required>
                    <input id="submit_wpcargo" class="wpcargo-btn wpcargo-btn-primary" name="wpcargo-submit" type="submit" value="TRACK SHIPMENT">
                </p>
            </form>
        </div>
        <?php
    }
    // Remove the defualt form template
    remove_action( 'wpcargo_track_form', array( $wpcargo_track_form, 'wpcargo_trackform_template' ), 10 );
    // Add new hook for the new form template
    add_action( 'wpcargo_track_form', 'my_custom_wpcargo_track_form' );

}, 25 );

Screenshots:

0
    0
    Your Cart
    Your cart is emptyReturn to Shop