Created
May 8, 2019 17:47
-
-
Save lcenine/ad1d0d10070a7ad262e446eae27229cb to your computer and use it in GitHub Desktop.
Fix Woocommerce issue with USPS and -100% Price Adjustment.
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
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