Last active
September 22, 2022 02:36
-
-
Save woogist/aae6acd042990ce75800ef43aa4e371a to your computer and use it in GitHub Desktop.
Hide unused shipping providers - https://docs.woocommerce.com/document/shipment-tracking/#section-7
This file contains hidden or 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['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']); // Removes all US options | |
unset($providers['United States']['Fedex']); | |
unset($providers['United States']['FedEx Sameday']); | |
unset($providers['United States']['UPS']); | |
unset($providers['United States']['USPS']); | |
unset($providers['United States']['OnTrac']); | |
unset($providers['United States']['DHL US']); | |
return $providers; | |
} |
In line 23 'e' should be lower case, but in line 24 'e' should be upper case:
unset($providers['United States']['Fedex']);
unset($providers['United States']['FedEx Sameday']);
Needs Poland added after line 17:
unset($providers['Poland']);
I see this code but where do I add it in wordpress to make the changes? In the functions.php file?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The second 'e' in Fedex should be capitalized on line 24.