Are threre changes in the filter woocommerce_package_rates after 2.6
-
Hello,
I was using the code below to hide all shipping methods if a coupon for free shipping is applied and to leave only the free option. Now it is not working and I think that i has to do something with the new implementation of the Shipping zones ( currently I’m not using any shipping zone and have left everything to default to the global one).
add_filter( 'woocommerce_package_rates', 'hide_table_rate_shipping_when_free_is_available' , 10, 1 ); function hide_table_rate_shipping_when_free_is_available( $available_methods ) { if( isset( $available_methods['free_shipping'] ) ) { foreach( $available_methods as $method_name => $method ) { // check if method starts with 'table_rate' and remove it if ( $method_name !='free_shipping' ) unset( $available_methods[ $method_name ] ); } } return $available_methods; }
Any clues where to dig for some info is welcomed. Thanks a lot.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Are threre changes in the filter woocommerce_package_rates after 2.6’ is closed to new replies.