Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save lcenine/ad1d0d10070a7ad262e446eae27229cb to your computer and use it in GitHub Desktop.
Save lcenine/ad1d0d10070a7ad262e446eae27229cb to your computer and use it in GitHub Desktop.
Fix Woocommerce issue with USPS and -100% Price Adjustment.
function find_free( $rates, $package ) {
// Make sure rate is available
if ( isset( $rates['usps:D_FIRST_CLASS'] ) ) {
// Go ahead and change the label to display something as $0.00 dollars does not populate. It just says USPS by default.
$rates['usps:D_FIRST_CLASS']->label = "USPS - FREE SHIPPING";
// Set the cost to 0.
$rates ['usps:D_FIRST_CLASS']->cost = 0;
}
return $rates;
}
add_filter( 'woocommerce_package_rates', 'find_free', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment