Home Forums WoodMart support forum Add free shipping

Add free shipping

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #87676

    attilio
    Participant

    Hi, i want hide all shipping method is free shipping is active. I have addede this code snippte but don’t work

    add_filter( ‘woocommerce_package_rates’, ‘hide_shipping_when_free_is_available_all_zones’, 10, 2 );

    function hide_shipping_when_free_is_available_all_zones( $rates, $package ) {

    $all_free_rates = array();

    foreach ( $rates as $rate_id => $rate ) {
    if ( ‘free_shipping’ === $rate->method_id ) {
    $all_free_rates[ $rate_id ] = $rate;
    break;
    }
    }

    if ( empty( $all_free_rates )) {
    return $rates;
    } else {
    return $all_free_rates;
    }
    }

    Can you help me?

    #87686

    Hello,

    Shipping is configured in Woocommerce > Settings > Shipping

    You do not need to insert any code, you can configure the free shipping without any modifications.

    Just edit your shipping zones and set free shipping http://prntscr.com/lfe6fh

    Best Regards

    #87688

    attilio
    Participant

    My question is another, i want hide all methods in the chechout page if is active free shipping

    Attachments:
    You must be logged in to view attached files.
    #87696

    Hello,

    Add this code to the Theme Settings > Custom CSS > Global:

    .woocommerce-shipping-totals{
        display:none;
    }

    Best Regards

    #87697

    attilio
    Participant

    No, this method hide all shipping. I don’t want this. I want hide all shipping method IF FREE SHIPPING IS AVAILABLE. Look the attachments in previus post

    #87714

    Artem Temos
    Keymaster

    Could you please check how the code you used works with standard WordPress theme? Our theme doesn’t influence that functionality in WooCommerce.

Viewing 6 posts - 1 through 6 (of 6 total)