Website Building » WooCommerce » How Do I Create a Tracking Page in WooCommerce?

How Do I Create a Tracking Page in WooCommerce?

Last updated on January 18, 2023 @ 6:28 am

There are a few different ways that you can go about creating a tracking page in WooCommerce. You can either use a plugin or do it manually.

If you want to use a plugin, we recommend using the WooCommerce Order Tracking plugin. This plugin will allow you to add a tracking page to your WooCommerce store easily. Simply install and activate the plugin, and then follow the instructions on the settings page.

If you want to do it manually, you will need to edit your theme files. First, you will need to create a new page template file called tracking.php. You can do this by copying the contents of your existing page.php file and then editing it as needed.

Next, you will need to add the following code to your tracking.php file:

<?php
/*
Template Name: Tracking Page
*/
?>
 
<?php get_header(); ?>
 
<div id="primary" class="content-area">
    <main id="main" class="site-main" role="main">

        <?php while ( have_posts() ) : the_post(); ?>

            <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>

                <div class="entry-content">

                    <?php the_content(); ?>

                    <?php if ( is_order_tracked() ) : // If order is tracked, display tracking form. ?>

                        <form action="" method="get">

                            <p><label for="orderid">Enter your Order ID:</label> <input type="text" name="orderid" id="orderid"></p>

                            <p><label for="email">Enter your Email Address:</label> <input type="text" name="email" id="email"></p>

                            <input type="submit" value="Track">

                        </form>

                    <?php else : // If order is not tracked, display message.?>

                        <p>Your order is not tracked.</p>

                    <?php endif; ?>

                </div><!-- .entry-content -->

            </article><!-- #post-## -->

        <?php endwhile; // end of the loop. ?>

    </main><!-- #main -->
</div><!-- #primary -->
Morgan Bash

Morgan Bash

Technology enthusiast and Co-Founder of Women Coders SF.