Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ibrahim-kardi/707dca5a00574753fcec16b397cc8101 to your computer and use it in GitHub Desktop.
Save ibrahim-kardi/707dca5a00574753fcec16b397cc8101 to your computer and use it in GitHub Desktop.
get woocommerce state under the country
$valid_states = WC()->countries->get_states( $country );
$for_country = isset( $args['country'] ) ? $args['country'] : WC()->checkout->get_value( 'billing_state' === $key ? 'billing_country' : 'shipping_country' );
$states = WC()->countries->get_states( $for_country );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment