« Back to Knowledge Base

How to Add Shipment Tracking Information in Email Templates

24 views WooCommerce Email Template Customizer

If you’re using an order tracking plugin, and this plugin has a function to attach the tracking info in WooCommerce order emails, these tracking info is the additional info. You can attach these info to email templates created by our plugin WooCommerce Email Template Customizer.

Basically, WooCommerce email notifications are not available with the tracking information in the orders notification emails. In fact, as a shop owner, you are aware of how important tracking information is in the orders, which allows to inform customers about their shipment journey. For this purpose, this article presents how to display tracking information in the orders email templates of the WooCommerce Email Template Customizer plugin

We thought about this problem and released the WooCommerce Email Template Customizer plugin, which offers a lot of amazing features including letting show the email contents of a 3rd plugin in general and the tracking information of a 3rd orders tracking plugin in particular. Now, scroll down to see how you work them out

Let’s get started.

WooCommerce Orders Tracking – SMS – PayPal Tracking Autopilot

WC Hook element is integrated to the email that allows you to insert custom code at points wherever the hooks run. If you want to display the content of WooCommerce Orders Tracking – SMS – PayPal Tracking Autopilot plugins, just drag and drop the WC Hook element to the position which you want to display in the email template. In particular, there are 3 hook positions, you can choose with this plugin: Before order table, After order table, Or order meta hook, just click on the element to switch among these positions. Here’s the full instruction for additional info in general.

You can see this video on how to use the WC Hook element of the WooCommerce Email Template customizer plugin:

 

How to Show Order Tracking Information in WooCommerce Emails

When using WooCommerce Orders Tracking – SMS – PayPal Tracking Autopilot together with WooCommerce Email Template Customizer, you can easily display order tracking information in your customized WooCommerce emails.

There are two ways to add tracking information to your email template:

A. Display Order Tracking Info Using the WC Hook Component.

B. Display Order Tracking in the Order Detail component.

A. Display Order Tracking Info Using the WC Hook Component

You can use WooCommerce Orders Tracking – SMS – PayPal Tracking Autopilot with WooCommerce Email Template Customizer to display tracking information in your customized WooCommerce emails.

To set it up, follow the steps below.

Step 1: Enable Tracking Information in WooCommerce Emails

After installing and activating WooCommerce Orders Tracking – SMS – PayPal Tracking Autopilot, go to: Orders Tracking → WooCommerce Email Enable the Include tracking in WooCommerce email option.

This allows the plugin to include tracking information in your WooCommerce emails.

Step 2: Select a Tracking Information Position

In the Tracking info position setting, you can choose where the tracking information will be displayed.

There are three available options:

  • Before order table
  • After order table
  • After each order item (This option allows you to display tracking information in the Order Detail component. Follow this step to learn how to configure it)

Each option works differently when used with WooCommerce Email Template Customizer.

Before order table

If you select Before order table in the Tracking info position setting, you need to use the corresponding WooCommerce hook in the WC Hook component.

In WooCommerce Email Template Customizer:

  1. Add the WC Hook component to your email template.
  2. In the hook selection field, select: woocommerce_email_before_order_table

  3. Save your email template. After saving the email template, the tracking information will be automatically displayed in the customer’s email according to the selected tracking position.

After order table

If you select After order table in the Tracking info position setting, you need to use the corresponding WooCommerce hook in the WC Hook component.

In WooCommerce Email Template Customizer:

  1. Add the WC Hook component to your email template.
  2. In the hook selection field, select: woocommerce_email_after_order_table

  3. Save your email template. After saving the email template, the tracking information will be automatically displayed in the customer’s email according to the selected tracking position.

 

B. Display Order Tracking Info Using the WC Hook Component

How to Include Shipment Tracking Numbers in Message Templates

You can easily add a shipment tracking number to your message template by following the straightforward method outlined in the linked post below. Additionally, we’ll guide you through creating a shipment tracking number placeholder for major WooCommerce shipping tracking plugins. With this approach, you can generate your own placeholder for any plugin, in particular with WooCommerce Email Template Customizer plugin by VillaTheme without requiring any developer expertise or coding skills.

WooCommerce Shipment Tracking plugin and Advanced Shipment Tracking for WooCommerce

With WooCommerce Shipment Tracking and Advanced Shipment Tracking, the shipment tracking number for your order is stored in the order meta (postmeta table) with the key _wc_shipment_tracking_items. However, as the tracking number is saved as an array, you’ll need to specify the array key in the placeholder to ensure it functions correctly.

For order data, the placeholder format begins with {{order-}. Following this, you need to specify your meta key, which for Shipment Tracking by WooCommerce and Advanced Shipment Tracking is _wc_shipment_tracking_items. Since the details are stored in an array and the array key for the tracking number, as per their documentation, istracking_number, you’ll need to include this in the placeholder with a colon separator (:), like :tracking_number. Therefore, the final placeholder will appear as follows:

{{order-_wc_shipment_tracking_items:tracking_number}}

By employing this approach, you can generate placeholders for any value associated with the plugin or any other plugin that stores data in the database using an array. If you’re uncertain about your meta key and array, you can reach out to the developer of the respective plugin for clarification. Alternatively, you can explore your database independently to gather this information.

Below are placeholders that can be used for these 2 tracking plugins:

Tracking Number: {{order-_wc_shipment_tracking_items:tracking_number}}
Tracking Provider: {{order-_wc_shipment_tracking_items:tracking_provider}}
Date Shipped: {{order-_wc_shipment_tracking_items:date_shipped}}
Custom Tracking Provider: {{order-_wc_shipment_tracking_items:custom_tracking_provider}}
Custom Tracking Link: {{order-_wc_shipment_tracking_items:custom_tracking_link}}

Note: Please note that the provided shortcodes are specifically designed for use with the WooCommerce Shipment Tracking Plugin and Advanced Shipment Tracking. However, you can apply the same method to create placeholders for any plugin that stores data in an array format.

The shortcode of WooCommerce Shipment Tracking and Advanced Shipment Tracking for WooCommerce will be written in WooCommerce Email Template Customizer like these:

Tracking Number: [wec_order_meta key="_wc_shipment_tracking_items" array_key="tracking_number"]
Tracking Provider: [wec_order_meta key="_wc_shipment_tracking_items" array_key="tracking_provider"]
Date Shipped: [wec_order_meta key="_wc_shipment_tracking_items" array_key="date_shipped"]
Custom Tracking Provider: [wec_order_meta key="_wc_shipment_tracking_items" array_key="custom_tracking_provider"]
Custom Tracking Link:[wec_order_meta key="_wc_shipment_tracking_items" array_key="custom_tracking_link"]

 

WooCommerce Shipping Tracking

WooCommerce Shipping Tracking stores data not only in a single meta key but also utilize an array format for additional tracking numbers. As the data resides in the postmeta table, the tracking placeholders will begin with {{post-.

Primary Tracking Number: {{post-_wcst_order_trackno}}
Primary Courier Name: {{post-_wcst_order_trackname}}
Primary Dispatch Date: {{post-_wcst_order_dispatch_date}}
Primary Custom Text: {{post-_wcst_custom_text}}
Primary Tracking URL: {{post-_wcst_order_track_http_url}}

Additional Tracking Number: {{post-_wcst_additional_companies:_wcst_order_trackno}}
Additional Courier Name: {{post-_wcst_additional_companies:_wcst_order_trackname}}
Additional Dispatch Date: {{post-_wcst_additional_companies:_wcst_order_dispatch_date}}
Additional Custom Text: {{post-_wcst_additional_companies:_wcst_custom_text}}
Additional Tracking URL: {{post-_wcst_additional_companies:_wcst_order_track_http_url}}

Note: The shortcodes are specifically designed for use with the WooCommerce Shipping Tracking plugin. However, you can apply the same method to create placeholders for any plugin that stores data in an array format.

The shortcode of WooCommerce Shipping Tracking will be written in WooCommerce Email Template Customizer like these:

Primary Tracking Number: [wec_order_meta key="_wcst_order_trackno"]
Primary Courier Name: [wec_order_meta key="_wcst_order_trackname"]
Primary Dispatch Date: [wec_order_meta key="_wcst_order_dispatch_date"]
Primary Custom Text: [wec_order_meta key="_wcst_custom_text"]
Primary Tracking URL:[wec_order_meta key="_wcst_order_track_http_url"]

Additional Tracking Number: [wec_order_meta key="_wcst_additional_companies" array_key="_wcst_order_trackno"]
Additional Courier Name: [wec_order_meta key="_wcst_additional_companies" array_key="_wcst_order_trackname"]
Additional Dispatch Date: [wec_order_meta key="_wcst_additional_companies" array_key="_wcst_order_dispatch_date"]
Additional Custom Text: [wec_order_meta key="_wcst_additional_companies" array_key="_wcst_custom_text"]
Additional Tracking URL: [wec_order_meta key="_wcst_additional_companies" array_key="_wcst_order_track_http_url"]

Yith WooCommerce Order Tracking

As Yith doesn’t store its tracking data in an array format like the previous plugin, creating and understanding the placeholder is much simpler. Additionally, most plugins don’t store their data in an array, so this process will be the same for many plugins.

The data from Yith is stored in the postmeta table of WordPress, so the placeholder will start with {{post- as a prefix. Their tracking data is stored with the metaywot_tracking_code, so the tracking code for this plugin will be represented as follows: {{post-ywot_tracking_code}}.

Since no array is used in this data, we will not use an array identifier for this placeholder. This method allows you to create a placeholder for any plugin or tracking plugin that does not store its data in an array. If an array is used, then the ‘Shipment Tracking by WooCommerce’ method should be applied.

If you are uncertain about your meta key, you can contact the developer of the respective plugin or inspect your database to find it.

Below are placeholders that can be used for this plugin:

Tracking Code: {{post-ywot_tracking_code}}
Carrier Name: {{post-ywot_carrier_name}}
Pickup Date: {{post-ywot_pick_up_date}}

Premium Version

Carrier Name: {{post-ywot_carrier_id}}

Note: Please note that the provided shortcodes are specifically designed for use with the Yith WooCommerce Order Tracking. However, you can apply the same method to create placeholders for any plugin that stores data in an array format.

The shortcode of Yith WooCommerce Order Tracking will be written in WooCommerce Email Template Customizer like these:

Tracking Code: [wec_order_meta key="ywot_tracking_code"]
Carrier Name: [wec_order_meta key="ywot_carrier_name"]
Pickup Date: [wec_order_meta key="ywot_pick_up_date"]

Premium Version

Carrier Name: [wec_order_meta key="ywot_carrier_id"]