Created
December 1, 2014 14:56
-
-
Save NiBow/8185a5b9630c15e98493 to your computer and use it in GitHub Desktop.
Woocommerce - choose free and hide paid shipping if available
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
| /** | |
| * Hide free shipping option when Standard Shipping is available | |
| * | |
| * @param array $available_methods | |
| */ | |
| function mwe_hide_free_shipping_when_standard_shipping_is_available($available_methods) { | |
| // remove standard shipping option | |
| if (isset($available_methods['free_shipping']) AND isset( $available_methods['flat_rate'])) { | |
| unset($available_methods['free_shipping']); | |
| } | |
| return $available_methods; | |
| } | |
| add_filter('woocommerce_available_shipping_methods', 'mwe_hide_free_shipping_when_standard_shipping_is_available'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment