Last active
September 22, 2022 02:37
-
-
Save woogist/0eb9bb4bdb373b4894a8 to your computer and use it in GitHub Desktop.
Shipment Tracking: adds custom provider
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How can I set the provider name in a language other than English, e.g. Hebrew or Arabic?