-
-
Save sonnetmia/57a6a1ce4b98e439db9b2b7b4b205570 to your computer and use it in GitHub Desktop.
WooCommerce - Hide free shipping if others methods exists
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
<?php | |
/** | |
* Hide free shipping if others methods exists. | |
* | |
* @param array $available_methods | |
*/ | |
function custom_shipping_rules( $available_methods ) { | |
if ( isset( $available_methods['PAC'] ) || isset( $available_methods['SEDEX'] ) ) { | |
unset( $available_methods['free_shipping'] ); | |
} | |
return $available_methods; | |
} | |
add_filter( 'woocommerce_available_shipping_methods', 'custom_shipping_rules', 10, 1 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment