Skip to content

Instantly share code, notes, and snippets.

@claudiosanches
Last active June 2, 2016 05:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save claudiosanches/5847398 to your computer and use it in GitHub Desktop.
Save claudiosanches/5847398 to your computer and use it in GitHub Desktop.
WooCommerce - Hide free shipping if others methods exists
<?php
/**
* Hide free shipping if others methods exists.
*
* @param array $available_methods
*/
function custom_shipping_rules( $available_methods ) {
if ( isset( $available_methods['PAC'] ) || isset( $available_methods['SEDEX'] ) ) {
unset( $available_methods['free_shipping'] );
}
return $available_methods;
}
add_filter( 'woocommerce_available_shipping_methods', 'custom_shipping_rules', 10, 1 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment