hide flat rate shipping when free shipping is available not working
-
I have set a flat rate shipping and a free shipping for my shipping zone
when the total of cart is over 100euros the free shipping is appearing but the flat rate is not hiding
I have also tried the code at functions.php
add_filter( ‘woocommerce_package_rates’, ‘bbloomer_unset_shipping_when_free_is_available_in_zone’, 10, 2 );
function bbloomer_unset_shipping_when_free_is_available_in_zone( $rates, $package ) {
// Only unset rates if free_shipping is available
if ( isset( $rates[‘free_shipping:3’] ) ) {
unset( $rates[‘flat_rate:1’] );
}
return $rates;
}
can you please check ?
any suggestion will be great
thanks in advance
Hello,
We are sorry but we are not able to check this code since it is related to WooCommerce functionality.
Regards