Last active
December 22, 2023 15:55
-
-
Save SirDarcanos/af36d7fecfbcc219aabe5a3537dd58b5 to your computer and use it in GitHub Desktop.
Sell in Specific States/Provinces/Regions with 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 | |
/** | |
* @template Sell to Specific States/Provinces/Regions with WooCommerce | |
* @author Nicola Mustone | |
* @author_url https://nicolamustone.blog/2014/12/08/sell-in-specific-states-with-woocommerce/ | |
* @tested-up-to WooCommerce 8.4.X | |
*/ | |
function wc_sell_only_states( $states ) { | |
$states['US'] = array( | |
'CA' => __( 'California', 'woocommerce' ), | |
); | |
return $states; | |
} | |
add_filter( 'woocommerce_states', 'wc_sell_only_states' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment