-
-
Save JeroenSormani/354a5ea652ddb8a4c51d to your computer and use it in GitHub Desktop.
OLD - Hide other shipping when free shipping is available, except local pickup
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 | |
add_filter( 'woocommerce_package_rates', '_custom_hide_shipping' ); | |
function _custom_hide_shipping( $available_methods ) { | |
if ( isset( $available_methods['advanced_free_shipping'] ) && isset( $available_methods['local_pickup'] ) ) : | |
$new_methods = array( | |
'advanced_free_shipping' => $available_methods['advanced_free_shipping'], | |
'local_pickup' => $available_methods['local_pickup'], | |
); | |
return $new_methods; | |
endif; | |
if ( isset( $available_methods['free_shipping'] ) && isset( $available_methods['local_pickup'] ) ) : | |
$new_methods = array( | |
'advanced_free_shipping' => $available_methods['advanced_free_shipping'], | |
'local_pickup' => $available_methods['local_pickup'], | |
); | |
return $new_methods; | |
endif; | |
return $available_methods; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment