Add a custom Shipment Tracking provider

Use the wc_shipment_tracking_get_providers filter to add a carrier that is not included in Shipment Tracking’s built-in list. Providers are grouped by region, and each provider maps to the URL used to build customer-facing tracking links.

Note:

Use an HTTPS tracking URL from the carrier and test it with a real-format tracking number. A malformed URL can be saved successfully but still send customers to the wrong destination.

Example

↑ Back to top

The snippet adds Example Courier to the United States group. Shipment Tracking replaces %1$s with the tracking number when it creates the link.

<?php
add_filter(
    'wc_shipment_tracking_get_providers',
    function ( $providers ) {
        $providers['United States']['Example Courier'] =
            'https://example.com/track/%1$s';

        return $providers;
    }
);

Provider array structure

↑ Back to top
Array levelExamplePurpose
Provider groupUnited StatesControls the regional group shown in the order editor.
Provider nameExample CourierThe label stored with the tracking item and shown to customers.
Tracking URLhttps://example.com/track/%1$sThe URL format Shipment Tracking expands for each order.

URL placeholders

↑ Back to top

Shipment Tracking supports positional placeholders in provider URLs. Use only the values required by the carrier’s tracking page.

PlaceholderReplacement
%1$sTracking number
%2$sNormalized destination postcode
%3$sDestination country code

Keep the placeholder markers intact. Do not replace them with example data in the saved URL. Shipment Tracking substitutes and encodes the order-specific values when it formats the customer link.

Where the provider appears

↑ Back to top

The filter changes the provider list everywhere the extension requests it. The carrier appears in the order editor and in the REST API providers response. Tracking items saved with this provider use the same URL format in emails and customer account pages.

  • Add a tracking item with the new provider from an order.
  • Open the Preview link before saving and confirm the tracking URL is correct.
  • Check an order with an international address when the URL uses postcode or country placeholders.
  • Confirm the provider remains available after plugin and theme updates by keeping the snippet in a custom plugin or child theme.

Related Products

Offer add-ons like gift wrapping, special messages or other special options for your products.

Let customers subscribe to your products or services and pay on a weekly, monthly or annual basis.

Use of your personal data
We and our partners process your personal data (such as browsing data, IP Addresses, cookie information, and other unique identifiers) based on your consent and/or our legitimate interest to optimize our website, marketing activities, and your user experience.