public function load_country_states()
{
global $states;
// States set to array() are blank i.e. the country has no use for the state field.
$states = array('AF' => array(), 'AT' => array(), 'AX' => array(), 'BE' => array(), 'BI' => array(), 'CZ' => array(), 'DE' => array(), 'DK' => array(), 'EE' => array(), 'FI' => array(), 'FR' => array(), 'GP' => array(), 'GF' => array(), 'IS' => array(), 'IL' => array(), 'KR' => array(), 'MQ' => array(), 'NL' => array(), 'NO' => array(), 'PL' => array(), 'PT' => array(), 'RE' => array(), 'SG' => array(), 'SK' => array(), 'SI' => array(), 'LK' => array(), 'SE' => array(), 'VN' => array(), 'YT' => array());
// Load only the state files the shop owner wants/needs.
$allowed = array_merge($this->get_allowed_countries(), $this->get_shipping_countries());
if (!empty($allowed)) {
foreach ($allowed as $code => $country) {
if (!isset($states[$code]) && file_exists(WC()->plugin_path() . '/i18n/states/' . $code . '.php')) {
include WC()->plugin_path() . '/i18n/states/' . $code . '.php';
}
}
}
$this->states = apply_filters('woocommerce_states', $states);
}