Show local pickup and free shipping when minimun amount is set
-
Does any one knew how to do this :
If set the minimum amount for free shipping is $150,-. When this amount is reached It will show the options for local pickup and free shipping.
When the amount of $150,- is not reached I want to to show up the options flat rate an local pickup.
I am using this code, but this will only show Free Shipping and also hide the Local Pick-Up
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;
}
add_filter( ‘woocommerce_package_rates’, ‘my_hide_shipping_when_free_is_available’, 100 );
- The topic ‘Show local pickup and free shipping when minimun amount is set’ is closed to new replies.