Hide shipping options code not working after update to 2.3
-
Hi
Previously I have used a code snippet in my functions.php file to hide all other shipping methods when free shipping becomes available. But now after updating to 2.3 this is no longer working.
Here’s the current code
// Hide ALL shipping options when free shipping is available add_filter( 'woocommerce_available_shipping_methods', 'hide_all_shipping_when_free_is_available' , 10, 1 ); /** * Hide ALL Shipping option when free shipping is available * * @param array $available_methods */ function hide_all_shipping_when_free_is_available( $available_methods ) { if( isset( $available_methods['free_shipping'] ) ) : // Get Free Shipping array into a new array $freeshipping = array(); $freeshipping = $available_methods['free_shipping']; // Empty the $available_methods array unset( $available_methods ); // Add Free Shipping back into $avaialble_methods $available_methods = array(); $available_methods['free_shipping'] = $freeshipping; endif; return $available_methods; }
Anybody have any ideas on what needs to be changed here to get this working again? I’m in way over my head.
Thanks in advance
Steven
Viewing 10 replies - 1 through 10 (of 10 total)
Viewing 10 replies - 1 through 10 (of 10 total)
- The topic ‘Hide shipping options code not working after update to 2.3’ is closed to new replies.