Last active
August 29, 2015 14:15
-
-
Save emilstahl/dcd7efc622f80be82c68 to your computer and use it in GitHub Desktop.
Hide shipping rates when free shipping is available
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
add_filter( 'woocommerce_package_rates', 'hide_shipping_when_free_is_available', 10, 2 ); | |
/* Hide shipping rates when free shipping is available */ | |
function hide_shipping_when_free_is_available( $rates, $package ) { | |
// Only modify rates if free_shipping is present | |
if ( isset( $rates['free_shipping'] ) ) { | |
// To unset a single rate/method, do the following. This example unsets flat_rate shipping | |
unset( $rates['flat_rate'] ); | |
} | |
return $rates; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment