Any ideas how to auto select international shipping when choosing another country other than the U.S? I wrote the following function but it is not working; I also tried to get an answer in woocommerce support forum but I couldn’t succeed. Thank you Stackoverflow community 🙂
add_filter( 'woocommerce_available_shipping_methods', 'cj_woocommerce_available_shipping_methods' );
function cj_woocommerce_available_shipping_methods( $available_methods ) {
if ( isset( $available_methods['international_shipping'] ) ) {
foreach ( $available_methods as $key => $value ) {
if ( 'international_shipping' != $key ) {
unset( $available_methods[ $key ] );
}
}
}
return $available_methods;
}