[ad_1]
I fixed it for our site with this filter:
add_filter( 'woocommerce_package_rates', function ( $rates ) {
$notfree = array();
foreach ( $rates as $rate_id => $rate ) {
if ( 'free_shipping' !== $rate->method_id ) {
$notfree[ $rate_id ] = $rate;
break;
}
}
return ! empty( $notfree ) ? $notfree : $rates;
}, 100 );This works, because the weight based shipping already has a limit, so that it is not offered for cart values above 50€.
Hi @dermartin85,
I’m glad to hear that you were able to resolve your issue with the ‘woocommerce_package_rates’ filter. Your solution looks perfect for limiting the ‘free_shipping’ method when the weight-based shipping has a limit.
I’ll go ahead and mark this thread as solved now, but I’d like to thank you for your contribution to the solution, this will highly benefit the community.
