Hide Other Shipping Methods – Issues
-
Hi, first of all, Thank you for sharing your work. This is a great plugin!
You mind sharing get proper PHP snippet to hide all other shipping methods from displaying at checkout once all conditions set from this plugin have been met? I tried the codes below but it didn’t work. The other options rates still appears. I inserted it into my Child Theme / function.php Let me know. Thanks!
function my_hide_shipping_when_free_is_available( $rates ) {
$free = array();
foreach ( $rates as $rate_id => $rate ) {
if ( ‘shipping_method_0_pisol_extended_flat_shipping:9093’ === $rate->method_id ) {
$free[ $rate_id ] = $rate;
break;
}
}
return ! empty( $free ) ? $free : $rates;
}
add_filter( ‘woocommerce_package_rates’, ‘my_hide_shipping_when_free_is_available’, 100 );
- The topic ‘Hide Other Shipping Methods – Issues’ is closed to new replies.