Skip to content

Instantly share code, notes, and snippets.

@woogist
Last active September 22, 2022 02:37
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save woogist/0eb9bb4bdb373b4894a8 to your computer and use it in GitHub Desktop.
Shipment Tracking: adds custom provider
/**
* wc_shipment_tracking_add_custom_provider
*
* Adds custom provider to shipment tracking or add existing providers to another country.
*
* Change the country name, the provider name, and the URL (it must include the %1$s)
* Add one provider per line
*/
add_filter( 'wc_shipment_tracking_get_providers' , 'wc_shipment_tracking_add_custom_provider' );
function wc_shipment_tracking_add_custom_provider( $providers ) {
$providers['France']['French New Mail'] = 'https://example.com?id=%1$s'; // add a custom provider
$providers['United Kingdom']['UPS'] = 'https://www.ups.com/track?loc=en_GB&tracknum=%1$s&requester=WT'; // add UPS to the United Kingdom
return $providers;
}
@yaniv691
Copy link

How can I set the provider name in a language other than English, e.g. Hebrew or Arabic?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment