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 topThe 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 level | Example | Purpose |
|---|---|---|
| Provider group | United States | Controls the regional group shown in the order editor. |
| Provider name | Example Courier | The label stored with the tracking item and shown to customers. |
| Tracking URL | https://example.com/track/%1$s | The URL format Shipment Tracking expands for each order. |
URL placeholders
↑ Back to topShipment Tracking supports positional placeholders in provider URLs. Use only the values required by the carrier’s tracking page.
| Placeholder | Replacement |
|---|---|
%1$s | Tracking number |
%2$s | Normalized destination postcode |
%3$s | Destination 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 topThe 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.