Free shipping is offered although min price not reached

[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.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer