Skip to content

Instantly share code, notes, and snippets.

@ChromeOrange
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ChromeOrange/3ffbb92d1b08ad7a6fbb to your computer and use it in GitHub Desktop.
Save ChromeOrange/3ffbb92d1b08ad7a6fbb to your computer and use it in GitHub Desktop.
Change USPS package to envelope so that the dimensions are fixed, add to your theme functions.php file
/**
* USPS 4.0 introduced the ability for envelopes to be flexible you can disable this with this function
* Simply set the type to 'envelope' instead of 'package' for any of the flat rate services that USPS lists as envelopes
*/
add_filter( 'usps_flat_rate_boxes', 'custom_usps_flat_rate_boxes' );
function custom_usps_flat_rate_boxes( $flat_rate_boxes ) {
// Priority Mail Express Envelopes
$flat_rate_boxes["d13"]["type"] = 'envelope';
$flat_rate_boxes["d30"]["type"] = 'envelope';
$flat_rate_boxes["d55"]["type"] = 'envelope';
$flat_rate_boxes["d63"]["type"] = 'envelope';
$flat_rate_boxes["d98"]["type"] = 'envelope';
// Priority Mail Envelopes
$flat_rate_boxes["d16"]["type"] = 'envelope';
$flat_rate_boxes["d29"]["type"] = 'envelope';
$flat_rate_boxes["d38"]["type"] = 'envelope';
$flat_rate_boxes["d40"]["type"] = 'envelope';
$flat_rate_boxes["d42"]["type"] = 'envelope';
$flat_rate_boxes["d44"]["type"] = 'envelope';
// International Priority Mail Express
$flat_rate_boxes["i13"]["type"] = 'envelope';
$flat_rate_boxes["130"]["type"] = 'envelope';
// International Priority Mail
$flat_rate_boxes["i8"]["type"] = 'envelope';
$flat_rate_boxes["129"]["type"] = 'envelope';
return $flat_rate_boxes;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment