1. Documentation /
  2. Shipment Tracking

Shipment Tracking

The Shipment Tracking extension provides customers with an easy way to track shipments by adding a link to emails and order pages.

Allows you to add shipment tracking to emails sent to the customer (e.g., Completed Order email).

Installation

↑ Back to top
  1. Ensure your store meets the plugin requirements.
  2. Download the extension from your WooCommerce dashboard.
  3. Go to Plugins > Add New > Upload and select the ZIP file you just downloaded.
  4. Click Install Now and then Activate.

Adding tracking information to orders

↑ Back to top
Note: Shipment tracking details are added to the “completed order” email once the order status is marked as completed.

On the edit/view order screen, you will see a new write panel for shipment information:

Adding Order Shipment Tracking

To add shipment information for the customer to view:

Shipment Tracking Details
  1. Choose a provider. This should be the shipping company you use. If your provider is not listed, choose the Custom Provider option.
  2. Add the tracking number that the provider assigned. If you chose the custom option, you need to enter the full link to the company’s tracking page (if applicable).
  3. Choose a shipping date (optional), which is when the package was shipped.
  4. (optional) Test the preview link to see if it works as you expect.
  5. Save Tracking. This is also a good time to change the order status to Complete. Marking the order as Complete will send the Completed Order email to the customer, including the shipment tracking code.
  6. (optional) Add additional tracking numbers by clicking Add Tracking Number.
Completed Order email with tracking details and link
After an order has been edited to include the Shipment Tracking details, those details are added to all email notifications sent to the customer for that order. This includes order status changes as well as notifications sent using Order Actions.

Customization

↑ Back to top

Note: We are unable to provide support for customizations under our Support Policy. If you need to further customize a snippet, or extend its functionality, we highly recommend Codeable, or a Certified WooExpert.

Custom meta reference

↑ Back to top

The Shipping Tracking plugin stores the tracking information in the order meta with the meta key _wc_shipment_tracking_items. It’s an array with the following structure:

  • tracking_provider — String of predefined provider
  • custom_tracking_provider — String of custom provider
  • custom_tracking_link — String of custom tracking URL
  • tracking_number — String of tracking number
  • date_shipped — Timestamp of shipment date

Developers can use the helper function wc_st_add_tracking_number to add tracking info to an order. In this helper function, the field $custom_url is optional.

if ( function_exists( 'wc_st_add_tracking_number' ) ) {
wc_st_add_tracking_number( $order_id, $tracking_number, $provider, $date_shipped, $custom_url );
}
view raw example.php hosted with ❤ by GitHub

Current available shipping providers

↑ Back to top
  • Australia
    • Australia Post
    • Fastway Couriers
  • Austria
    • post.at
    • dhl.at
    • DPD.at
  • Brazil
    • Correios
  • Belgium
    • bpost
  • Canada
    • Canada Post
  • Czech Republic
    • PPL.cz
    • Česká pošta
    • DHL.cz
    • DPD.cz
  • Finland
    • Itella
  • France
    • Colissimo
  • Germany
    • DHL Intraship (DE)
    • Hermes
    • Deutsche Post DHL
    • UPS Germany
    • DPD.de
  • Ireland
    • DPD.ie
    • An Post
  • Italy
    • BRT (Bartolini)
    • DHL Express
  • India
    • DTDC
  • Netherlands
    • PostNL
    • DPD.NL
    • UPS Netherlands
  • New Zealand
    • Courier Post
    • NZ Post
    • Fastways
    • PBT Couriers
  • Poland
    • InPost
    • DPD.PL
    • Poczta Polska
  • Romania
    • Fan Courier
    • DPD Romania
    • Urgent Cargus
  • South Africa
    • SAPO
    • Fastway
  • Sweden
    • PostNord Sverige AB
    • DHL.se
    • Bring.se
    • UPS.se
    • DB Schenker
  • United Kingdom
    • DHL
    • DPD.co.uk
    • InterLink
    • ParcelForce
    • Royal Mail
    • TNT Express (consignment)
    • TNT Express (reference)
    • DHL Parcel UK
  • United States
    • Fedex
    • FedEx Sameday
    • OnTrac
    • UPS
    • USPS
    • DHL US
    • DHL eCommerce US

Change the default shipment provider

↑ Back to top

The plugin provides a hook for changing the default provider from ‘custom’ called woocommerce_shipment_tracking_default_provider. This can be used by adding a custom function to your theme functions.php file and passing back the name of the provider, which should be the default:

add_filter( 'woocommerce_shipment_tracking_default_provider', 'custom_woocommerce_shipment_tracking_default_provider' );
function custom_woocommerce_shipment_tracking_default_provider( $provider ) {
$provider = 'USPS';
return $provider;
}

Add custom providers dynamically

↑ Back to top

You can add custom providers dynamically by using this snippet in functions.php in your theme folder:

View on Github

Hide unused shipping providers

↑ Back to top

You can hide the shipping providers you will not use with this snippet. Note: this code will remove ALL shipping providers. Remove the ones you want to appear before using. For example, if you want to use FedEx, then delete line 24.

add_filter( 'wc_shipment_tracking_get_providers', 'custom_shipment_tracking' );
function custom_shipment_tracking( $providers ) {
unset($providers['Australia']);
unset($providers['Austria']);
unset($providers['Brazil']);
unset($providers['Belgium']);
unset($providers['Canada']);
unset($providers['Czech Republic']);
unset($providers['Finland']);
unset($providers['France']);
unset($providers['Germany']);
unset($providers['Ireland']);
unset($providers['Italy']);
unset($providers['India']);
unset($providers['Netherlands']);
unset($providers['New Zealand']);
unset($providers['Poland']);
unset($providers['Romania']);
unset($providers['South African']);
unset($providers['Sweden']);
unset($providers['United Kingdom']);
unset($providers['United States']); // Removes all US options
unset($providers['United States']['Fedex']);
unset($providers['United States']['FedEx Sameday']);
unset($providers['United States']['UPS']);
unset($providers['United States']['USPS']);
unset($providers['United States']['OnTrac']);
unset($providers['United States']['DHL US']);
return $providers;
}

REST API Support

↑ Back to top

Works with WooCommerce API v1, v2, and v3. In the documentation, only v3 is shown.

Shipment Tracking REST API

The shipment tracking REST API allows you to create, view, and delete individual shipment tracking. The endpoint is /wp-json/wc-shipment-tracking/v3/.

Shipment Tracking Properties

Attribute Type Description
tracking_id string Unique identifier for shipment tracking read-only
tracking_number string Tracking number required
tracking_provider string Tracking provider name
tracking_link url Tracking link
date_shipped date Date when package was shipped

Create a shipment tracking

POST /wp-json/wc-shipment-tracking/v3/orders/645/shipment-trackings

If predefined provider name is used, then no need to pass tracking_link.

curl -X POST https://example.com/wp-json/wc-shipment-tracking/v3/orders/645/shipment-trackings \
    -u consumer_key:consumer_secret \
    -H "Content-Type: application/json" \
    -d '{
  "tracking_provider": "TNT Express (consignment)",
  "tracking_number": "12345678",
}'

JSON response example:

{
  "tracking_id": "7f4978c390ee633c6294ae0f258656f9",
  "tracking_provider": "TNT Express (consignment)",
  "tracking_link": "http://www.tnt.com/webtracker/tracking.do?requestType=GEN&searchType=CON&respLang=en&\nrespCountry=GENERIC&sourceID=1&sourceCountry=ww&cons=12345678&navigation=1&g\nenericSiteIdent=",
  "tracking_number": "12345678",
  "date_shipped": "2016-08-11",
  "_links": {
    "self": [
      {
        "href": "https://example.com/wp-json/wc-shipment-tracking/v3/orders/4497/shipment-trackings/7f4978c390ee633c6294ae0f258656f9"
      }
    ],
    "collection": [
      {
        "href": "https://example.com/wp-json/wc-shipment-tracking/v3/orders/4497/shipment-trackings"
      }
    ],
    "up": [
      {
        "href": "https://example.com/wp-json/wc-shipment-tracking/v3/orders/4497"
      }
    ]
  }
}

Using custom provider:

curl -X POST https://example.com/wp-json/wc-shipment-tracking/v3/orders/645/shipment-trackings \
    -u consumer_key:consumer_secret \
    -H "Content-Type: application/json" \
    -d '{
  "custom_tracking_provider": "Custom",
  "custom_tracking_link": "https://example.com?q=%1$s",
  "tracking_number": "12345678"
}'

Retrieve a shipment tracking

GET /wp-json/wc-shipment-tracking/v3/orders/<order_id>/shipment-trackings/<tracking-id>
curl -X GET https://example.com/wp-json/wc-shipment-tracking/v3/orders/645/shipment-trackings/7f4978c390ee633c6294ae0f258656f9 \
    -u consumer_key:consumer_secret \

JSON response example:

{
  "tracking_id": "7f4978c390ee633c6294ae0f258656f9",
  "tracking_provider": "TNT Express (consignment)",
  "tracking_link": "http://www.tnt.com/webtracker/tracking.do?requestType=GEN&searchType=CON&respLang=en&\nrespCountry=GENERIC&sourceID=1&sourceCountry=ww&cons=12345678&navigation=1&g\nenericSiteIdent=",
  "tracking_number": "12345678",
  "date_shipped": "2016-08-11",
  "_links": {
    "self": [
      {
        "href": "https://example.com/wp-json/wc-shipment-tracking/v3/orders/4497/shipment-trackings/7f4978c390ee633c6294ae0f258656f9"
      }
    ],
    "collection": [
      {
        "href": "https://example.com/wp-json/wc-shipment-tracking/v3/orders/4497/shipment-trackings"
      }
    ],
    "up": [
      {
        "href": "https://example.com/wp-json/wc-shipment-tracking/v3/orders/4497"
      }
    ]
  }
}

List all shipment trackings

GET /wp-json/wc-shipment-tracking/v3/orders/<order_id>/shipment-trackings/
curl -X GET https://example.com/wp-json/wc-shipment-tracking/v3/orders/645/shipment-trackings \
    -u consumer_key:consumer_secret \

JSON response example:

[
  {
    "tracking_id": "c8ce8278b1e6ddc93b1b465992bac886",
    "tracking_provider": "TNT Express (consignment)",
    "tracking_link": "http://www.tnt.com/webtracker/tracking.do?requestType=GEN&searchType=CON&respLang=en&\nrespCountry=GENERIC&sourceID=1&sourceCountry=ww&cons=12345678&navigation=1&g\nenericSiteIdent=",
    "tracking_number": "12345678",
    "date_shipped": "2016-08-10",
    "_links": {
      "self": [
        {
          "href": "https://example.com/wp-json/wc-shipment-tracking/v3/orders/4497/shipment-trackings/c8ce8278b1e6ddc93b1b465992bac886"
        }
      ],
      "collection": [
        {
          "href": "https://example.com/wp-json/wc-shipment-tracking/v3/orders/4497/shipment-trackings"
        }
      ],
      "up": [
        {
          "href": "https://example.com/wp-json/wc-shipment-tracking/v3/orders/4497"
        }
      ]
    }
  }
]

Delete a shipment tracking

DELETE /wp-json/wc-shipment-tracking/v3/orders/<order_id>/shipment-trackings/<tracking-id>
curl -X DELETE https://example.com/wp-json/wc-shipment-tracking/v3/orders/645/shipment-trackings/c8ce8278b1e6ddc93b1b465992bac886 \
    -u consumer_key:consumer_secret \

JSON response example:


  "tracking_id": "c8ce8278b1e6ddc93b1b465992bac886",
  "tracking_provider": "TNT Express (consignment)",
  "tracking_link": "http://www.tnt.com/webtracker/tracking.do?requestType=GEN&searchType=CON&respLang=en&\nrespCountry=GENERIC&sourceID=1&sourceCountry=ww&cons=12345678&navigation=1&g\nenericSiteIdent=",
  "tracking_number": "12345678",
  "date_shipped": "2016-08-10",
  "_links": {
    "self": [
      {
        "href": "https://example.com/wp-json/wc-shipment-tracking/v3/orders/4497/shipment-trackings/c8ce8278b1e6ddc93b1b465992bac886"
      }
    ],
    "collection": [
      {
        "href": "https://example.com/wp-json/wc-shipment-tracking/v3/orders/4497/shipment-trackings"
      }
    ],
    "up": [
      {
        "href": "https://example.com/wp-json/wc-shipment-tracking/v3/orders/4497"
      }
    ]
  }
}

List all shipment tracking providers

GET /wp-json/wc-shipment-tracking/v3/orders/<order_id>/shipment-trackings/providers
curl -X GET https://example.com/wp-json/wc-shipment-tracking/v3/orders/645/shipment-trackings/providers \
    -u consumer_key:consumer_secret \

JSON response example:

{
  "Australia": {
    "Australia Post": "http://auspost.com.au/track/track.html?id=%1$s",
    "Fastway Couriers": "http://www.fastway.com.au/courier-services/track-your-parcel?l=%1$s"
  },
  "Austria": {
    "post.at": "http://www.post.at/sendungsverfolgung.php?pnum1=%1$s",
    "dhl.at": "http://www.dhl.at/content/at/de/express/sendungsverfolgung.html?brand=DHL&AWB=%1$s",
    "DPD.at": "https://tracking.dpd.de/parcelstatus?locale=de_AT&query=%1$s"
  },
  "Brazil": {
    "Correios": "http://websro.correios.com.br/sro_bin/txect01$.QueryList?P_LINGUA=001&P_TIPO=001&P_COD_UNI=%1$s"
  },
  "Canada": {
    "Canada Post": "http://www.canadapost.ca/cpotools/apps/track/personal/findByTrackNumber?trackingNumber=%1$s"
  },
  "Czech Republic": {
    "PPL.cz": "http://www.ppl.cz/main2.aspx?cls=Package&idSearch=%1$s",
    "Česká pošta": "https://www.postaonline.cz/trackandtrace/-/zasilka/cislo?parcelNumbers=%1$s",
    "DHL.cz": "http://www.dhl.cz/cs/express/sledovani_zasilek.html?AWB=%1$s",
    "DPD.cz": "https://tracking.dpd.de/parcelstatus?locale=cs_CZ&query=%1$s"
  },
  "Finland": {
    "Itella": "http://www.posti.fi/itemtracking/posti/search_by_shipment_id?lang=en&ShipmentId=%1$s"
  },
  "France": {
    "Colissimo": "http://www.colissimo.fr/portail_colissimo/suivre.do?language=fr_FR&colispart=%1$s"
  },
  "Germany": {
    "DHL Intraship (DE)": "http://nolp.dhl.de/nextt-online-public/set_identcodes.do?lang=de&idc=%1$s&rfn=&extendedSearch=true",
    "Hermes": "https://tracking.hermesworld.com/?TrackID=%1$s",
    "Deutsche Post DHL": "http://nolp.dhl.de/nextt-online-public/set_identcodes.do?lang=de&idc=%1$s",
    "UPS Germany": "http://wwwapps.ups.com/WebTracking/processInputRequest?sort_by=status&tracknums_displayed=1&TypeOfInquiryNumber=T&loc=de_DE&InquiryNumber1=%1$s",
    "DPD.de": "https://tracking.dpd.de/parcelstatus?query=%1$s&locale=en_DE"
  },
  "Ireland": {
    "DPD.ie": "http://www2.dpd.ie/Services/QuickTrack/tabid/222/ConsignmentID/%1$s/Default.aspx",
    "An Post": "https://track.anpost.ie/TrackingResults.aspx?rtt=1&items=%1$s"
  },
  "Italy": {
    "BRT (Bartolini)": "http://as777.brt.it/vas/sped_det_show.hsm?referer=sped_numspe_par.htm&Nspediz=%1$s",
    "DHL Express": "http://www.dhl.it/it/express/ricerca.html?AWB=%1$s&brand=DHL"
  },
  "India": {
    "DTDC": "http://www.dtdc.in/dtdcTrack/Tracking/consignInfo.asp?strCnno=%1$s"
  },
  "Netherlands": {
    "PostNL": "https://mijnpakket.postnl.nl/Claim?Barcode=%1$s&Postalcode=%2$s&Foreign=False&ShowAnonymousLayover=False&CustomerServiceClaim=False",
    "DPD.NL": "http://track.dpdnl.nl/?parcelnumber=%1$s"
  },
  "New Zealand": {
    "Courier Post": "http://trackandtrace.courierpost.co.nz/Search/%1$s",
    "NZ Post": "http://www.nzpost.co.nz/tools/tracking?trackid=%1$s",
    "Fastways": "http://www.fastway.co.nz/courier-services/track-your-parcel?l=%1$s",
    "PBT Couriers": "http://www.pbt.com/nick/results.cfm?ticketNo=%1$s"
  },
  "South African": {
    "SAPO": "http://sms.postoffice.co.za/TrackingParcels/Parcel.aspx?id=%1$s"
  },
  "Sweden": {
    "Posten AB": "http://www.posten.se/sv/Kundservice/Sidor/Sok-brev-paket.aspx?search=%1$s",
    "DHL.se": "http://www.dhl.se/content/se/sv/express/godssoekning.shtml?brand=DHL&AWB=%1$s",
    "Bring.se": "http://tracking.bring.se/tracking.html?q=%1$s",
    "UPS.se": "http://wwwapps.ups.com/WebTracking/track?track=yes&loc=sv_SE&trackNums=%1$s",
    "DB Schenker": "http://privpakportal.schenker.nu/TrackAndTrace/packagesearch.aspx?packageId=%1$s"
  },
  "United Kingdom": {
    "DHL": "http://www.dhl.com/content/g0/en/express/tracking.shtml?brand=DHL&AWB=%1$s",
    "DPD.co.uk": "http://www.dpd.co.uk/tracking/trackingSearch.do?search.searchType=0&search.parcelNumber=%1$s",
    "InterLink": "http://www.interlinkexpress.com/apps/tracking/?reference=%1$s&postcode=%2$s#results",
    "ParcelForce": "http://www.parcelforce.com/portal/pw/track?trackNumber=%1$s",
    "Royal Mail": "https://www.royalmail.com/track-your-item/?trackNumber=%1$s",
    "TNT Express (consignment)": "http://www.tnt.com/webtracker/tracking.do?requestType=GEN&searchType=CON&respLang=en&\nrespCountry=GENERIC&sourceID=1&sourceCountry=ww&cons=%1$s&navigation=1&g\nenericSiteIdent=",
    "TNT Express (reference)": "http://www.tnt.com/webtracker/tracking.do?requestType=GEN&searchType=REF&respLang=en&r\nespCountry=GENERIC&sourceID=1&sourceCountry=ww&cons=%1$s&navigation=1&gen\nericSiteIdent=",
    "UK Mail": "https://old.ukmail.com/ConsignmentStatus/ConsignmentSearchResults.aspx?SearchType=Reference&SearchString=%1$s"
  },
  "United States": {
    "Fedex": "http://www.fedex.com/Tracking?action=track&tracknumbers=%1$s",
    "FedEx Sameday": "https://www.fedexsameday.com/fdx_dotracking_ua.aspx?tracknum=%1$s",
    "OnTrac": "http://www.ontrac.com/trackingdetail.asp?tracking=%1$s",
    "UPS": "http://wwwapps.ups.com/WebTracking/track?track=yes&trackNums=%1$s",
    "USPS": "https://tools.usps.com/go/TrackConfirmAction_input?qtc_tLabels1=%1$s"
  }
}

Questions and Support

↑ Back to top

Something missing from this documentation? Do you still have questions and need assistance?

  • Have a question before you buy this extension? Please fill out this pre-sales form – please include the name of this extension in your query.
  • Already purchased and need some assistance? Get in touch with a Happiness Engineer via the WooCommerce.com Support page and choose this extension name from the “I need help with” dropdown