Created
May 13, 2015 15:05
-
-
Save growdev/af4844f0b58a741f245b to your computer and use it in GitHub Desktop.
Remove USA non-contiguous 48 states from WooCommerce
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Plugin Name: Grow Development Remove States | |
* Plugin URI: http://growdevelopment.com/ | |
* Description: This plugin removes states, provinces and armed forces locations outside contiguous 48 states. | |
* Version: 1.0.0 | |
* Author: Grow Development | |
* Author URI: http://growdevelopment.com/ | |
* | |
*/ | |
/** | |
* Only ship to the contiguous 48 states | |
*/ | |
add_filter( 'woocommerce_states', 'custom_woocommerce_states' ); | |
function custom_woocommerce_states( $states ) { | |
unset($states['US']['AK']); | |
unset($states['US']['HI']); | |
unset($states['US']['AA']); | |
unset($states['US']['AE']); | |
unset($states['US']['AP']); | |
unset($states['US']['AS']); | |
unset($states['US']['GU']); | |
unset($states['US']['MP']); | |
unset($states['US']['PR']); | |
unset($states['US']['UM']); | |
unset($states['US']['VI']); | |
return $states; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment