Created
March 20, 2025 20:30
-
-
Save greguly/980ec137674ebc06bc25aa26122b89c5 to your computer and use it in GitHub Desktop.
Filter out WooCommerce Shipment unused tracking services
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
add_filter( 'wc_shipment_tracking_get_providers', 'custom_shipment_tracking' ); | |
function custom_shipment_tracking( $providers ) { | |
unset($providers['Global']); | |
unset($providers['Australia']); | |
unset($providers['Austria']); | |
unset($providers['Brazil']); | |
unset($providers['Belgium']); | |
unset($providers['Canada']); | |
unset($providers['Czech Republic']); | |
unset($providers['Finland']); | |
unset($providers['France']); | |
unset($providers['Germany']); | |
unset($providers['Ireland']); | |
unset($providers['Italy']); | |
unset($providers['India']); | |
unset($providers['Netherlands']); | |
unset($providers['New Zealand']); | |
unset($providers['Poland']); | |
unset($providers['Romania']); | |
unset($providers['South African']); | |
unset($providers['Sweden']); | |
unset($providers['United Kingdom']); | |
// unset($providers['United States']); // Keeps United States | |
unset($providers['United States']['DHL eCommerce']); | |
unset($providers['United States']['Fedex']); | |
unset($providers['United States']['FedEx Sameday']); | |
unset($providers['United States']['GlobalPost']); | |
//unset($providers['United States']['UPS']); // Keeps UPS | |
unset($providers['United States']['USPS']); | |
unset($providers['United States']['OnTrac']); | |
unset($providers['United States']['DHL US']); | |
return $providers; | |
} | |
add_filter( 'woocommerce_shipment_tracking_default_provider', 'custom_woocommerce_shipment_tracking_default_provider' ); | |
function custom_woocommerce_shipment_tracking_default_provider( $provider ) { | |
$provider = 'UPS'; | |
return $provider; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment