Hide shipping methods when free shipping is available: WooCommerce 2.6 compatibility

If your store offers free shipping, WooCommerce’s default configuration is to show the free shipping option to the customer on checkout, but not automatically select it or remove the paid shipping options. There’s a code snippet that you can add to your theme’s functions.php file to hide other shipping methods when free shipping is available and we’d recommend this to all stores offering free shipping.

With WooCommerce 2.6 being released last month, you may have updated your store and noticed that this code snippet stopped working properly. Turns out, the new version of WooCommerce requires an updated code snippet, even if you haven’t switched over to the new Shipping Zones system. The documentation has been updated on WooCommerce’s site – or here it is for easy copy and pasting:

https://gist.github.com/mikejolley/7ced4986b0b9c4b1fffedbe3e6bb6860#file-functions-php

 

Back To Posts