• Resolved dermartin85

    (@dermartin85)


    We have Version 9.1.2 installed and I don’t know when exactly it started, but the free shipping is offered even if the minimum cart value is not reached. Normally it should use the free shipping starting with 50€ and before use weight based shipping. Weight based works and is offered, but if the price is below 10€ free shipping is offered additionally.

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter dermartin85

    (@dermartin85)

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

    Plugin Support ckadenge (woo-hc)

    (@ckadenge)

    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.

    Thread Starter dermartin85

    (@dermartin85)

    We now found another representation of the error. When the Price reached 100€ no shipping was showing. I deactivated my code to see if it had any effect, but it didn’t. I suspected there is some kind of wrong comparison between the total cart price and the threshold and took another look at the minimum price set for free shipping and noticed that the price is set in german notation. We use a comma where in english you use the dot and vice versa. So I removed the “,00” after the 50 and hit save. After saving the mask still showed the price as “50,00”, but it worked and now my workaround code is not needed either.

    So the Problem seems to only appear if you have set the price in the past and then updated woocommerce.

    Hey, @dermartin85!

    Thanks for sharing the information, and I’m glad you got it to work ??

    We actually have a developer blog with more information regarding this. If you are interested, you can read it here.

    Please let us know if there’s anything else we can do to help or if you have any questions.

    Have a wonderful day!

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.