Support » Plugin: WooCommerce » Setting Free Shipping with Minimum Order Amount

  • Hello

    I defined two types of delivery:
    Flat rate – a fixed amount for a reservation.
    Free Shipping – Minimum Order Amount

    The problem is that when the invitation is greater than the Minimum Order Amount I get two types of delivery.

    Should be:
    From under the Minimum Order Amount – fixed amount
    From about the Minimum Order Amount – Free Shipping (Now both of them are there)

    How do I make this distinction on the site?

    Thanks

    • This topic was modified 3 years, 1 month ago by healiny.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Add this snippet to your functions.php !

    add_filter( 'woocommerce_package_rates', 'my_hide_shipping_when_free_is_available', 100 );
    
    function my_hide_shipping_when_free_is_available( $rates ) {
    	$free = array();
    	foreach ( $rates as $rate_id => $rate ) {
    		if ( 'free_shipping' === $rate->method_id ) {
    			$free[ $rate_id ] = $rate;
    			break;
    		}
    	}
    	return ! empty( $free ) ? $free : $rates;
    }
    

    Thank you
    It works 🙂

    Hi
    What you gave me works well, thank you 🙂
    I would like to add also the Local Pickup.

    The problem is that when the invitation is greater than the Minimum Order Amount The Local Pickup gone.

    Should be:
    From under the Minimum Order Amount – fixed amount + Local Pickup
    From about the Minimum Order Amount – Free Shipping + Local Pickup

    How do I add this condition to this function?

    Thanks

    • This reply was modified 3 years, 1 month ago by healiny.

    Hi chezzone

    Thank you for taking me and helped me.
    There are other conditions of the code you gave me, and I will be happy if you reply and help me.

    Thanks.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Setting Free Shipping with Minimum Order Amount’ is closed to new replies.