This snippet applies specifically to vendor shipping methods. There is a similar snippet on WooCommerce.com, but slight changes are required to that for it to work with our plugin.
Hides everything but free_shipping and local_pickup if it’s available and is compatible with Shipping Zones:
add_filter('marketking_vendor_package_rates', function($rates){
$new_rates = array();
foreach ( $rates as $rate_id => $rate ) {
// Only modify rates if free_shipping is present.
if ( 'free_shipping' === $rate['value'] ) {
$new_rates[ $rate_id ] = $rate;
break;
}
}
if ( ! empty( $new_rates ) ) {
//Save local pickup if it's present.
foreach ( $rates as $rate_id => $rate ) {
if ('local_pickup' === $rate['value'] ) {
$new_rates[ $rate_id ] = $rate;
break;
}
}
return $new_rates;
}
return $rates;
}, 10, 1);
You can add the above code to your functions.php or to any snippets plugin.