Skip to content

Instantly share code, notes, and snippets.

@bryceadams
Last active August 29, 2015 14:16
Show Gist options
  • Save bryceadams/24765ad81e0696561848 to your computer and use it in GitHub Desktop.
Save bryceadams/24765ad81e0696561848 to your computer and use it in GitHub Desktop.
No Free Shipping for non-Continental US states
add_filter( 'woocommerce_package_rates', 'ba_hide_shipping_continental', 10, 2 );
function ba_hide_shipping_continental( $rates, $package ) {
global $woocommerce;
$excluded_states = array( 'AK','HI','GU','PR' );
if( in_array( $woocommerce->customer->get_shipping_state(), $excluded_states ) ) {
unset( $rates['free_shipping'] );
}
return $rates;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment