Use the woocommerce_shipment_tracking_default_provider filter to preselect the carrier your store uses most often. This reduces repetitive data entry when staff add tracking details from the WooCommerce order editor.
Note:
The filter changes only the default selection in the Shipment Tracking panel. It does not modify existing tracking items, change REST API requests, or force a provider when another option is selected.
Example
↑ Back to topThis example returns USPS whenever Shipment Tracking prepares the provider field. The returned value must match a provider label in the current provider list.
<?php
add_filter(
'woocommerce_shipment_tracking_default_provider',
function ( $provider ) {
return 'USPS';
}
);
Filter value
↑ Back to top| Value | Requirement |
|---|---|
| Filter name | woocommerce_shipment_tracking_default_provider |
| Argument | The current default provider value. |
| Return value | A provider name from the Shipment Tracking provider list. |
| Default priority | 10 |
| Accepted arguments | 1 |
Choose a valid provider name
↑ Back to topProvider labels are case-sensitive when the order editor selects an option. Use the exact label displayed in the provider dropdown, such as USPS, Canada Post, or Royal Mail. If another customization removes that provider from the list, the order editor cannot select it even when this filter returns its name.
For stores that need a carrier not included with the extension, add the carrier with the wc_shipment_tracking_get_providers filter first. The new provider can then be returned from this filter.
Test the default selection
↑ Back to top- Open an order and select Add Tracking Number.
- Confirm the expected provider is selected before entering a tracking number.
- Select another provider, save the tracking item, and confirm the saved item keeps the provider you chose.
- Check another user role that manages orders if your store customizes WooCommerce capabilities.
If the wrong provider remains selected, check for another callback attached to the same filter. A later callback can replace the value returned by this snippet.