Forked from woogists/usps-remove-priority-flat-rate-envelopes.php
Last active
October 2, 2022 12:57
-
-
Save tonyclemmey/f5b9a0e5e389b5dc0abd2a6ec0054788 to your computer and use it in GitHub Desktop.
[USPS Shipping Method] To remove all the USPS Priority Flat Rate envelopes, leaving only the Small, Medium, and Large Flat Rate boxes, add this to your theme's functions.php file:
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
<?php | |
/** | |
* Plugin Name: Woocommerce USPS Shipping Method remove flat rate envelopes | |
* Plugin URI: https://tcdesignio.co.uk | |
* Description: <code>Woocommerce USPS Shipping Method remove flat rate envelopes <strong> - TCDESIGN</strong></code> | |
* Version: 1.0.0 | |
* Tested up to: 6.0 | |
*/ | |
/** | |
* Remove USPS Flat rate envelopes from the available options | |
* Once added the customer will not see any rates for envelopes | |
* Only Small, Medium, and Large Flat Rate boxes will be used | |
*/ | |
add_filter( 'wc_usps_flat_rate_boxes', 'custom_usps_flat_rate_boxes' ); | |
function custom_usps_flat_rate_boxes( $flat_rate_boxes ) { | |
unset($flat_rate_boxes["d29"]); | |
unset($flat_rate_boxes["d30"]); | |
unset($flat_rate_boxes["d63"]); | |
unset($flat_rate_boxes["d16"]); | |
unset($flat_rate_boxes["d38"]); | |
unset($flat_rate_boxes["d40"]); | |
unset($flat_rate_boxes["d42"]); | |
unset($flat_rate_boxes["d44"]); | |
unset($flat_rate_boxes["d13"]); | |
unset($flat_rate_boxes["i33"]); | |
unset($flat_rate_boxes["i30"]); | |
unset($flat_rate_boxes["i63"]); | |
unset($flat_rate_boxes["i8"]); | |
unset($flat_rate_boxes["i29"]); | |
unset($flat_rate_boxes["i13"]); | |
return $flat_rate_boxes; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment