Shipping Zone Error
-
Hi , so I was looking at the debug.php file & I realised that I have some Shipping class zones errors which I cannot how to *fix*.
The errors are these
Undefined array key “MK/ST/KS/GB-NIR” in /wp-content/plugins/woocommerce/includes/class-wc-shipping-zone.php on line 125
FYI , I am using the below code in funcitions.php to make sure only the countries I allow are used in places where woocomerce adds countries , ps:. the priority is to have control over which countries are shown in countries field in woocomerce checkout page.// Filter allowed countries
add_filter('woocommerce_countries', 'filter_allowed_countries');
function filter_allowed_countries($countries) {
$allowed_countries = array(
'AE' => 'United Arab Emirates',
'OM' => 'Oman',
'PK' => 'Pakistan',
'QA' => 'Qatar',
'BH' => 'Bahrain',
'BD' => 'Bangladesh',
'SA' => 'Saudi Arabia',
'LK' => 'Sri Lanka',
'IN' => 'India',
'KW' => 'Kuwait',
'LB' => 'Lebanon',
'LY' => 'Libya',
'AT' => 'Austria',
'AU' => 'Australia',
'AZ' => 'Azerbaijan',
'FR' => 'France',
'GE' => 'Georgia',
'DE' => 'Germany',
'MC' => 'Monaco',
'MY' => 'Malaysia',
'MO' => 'Macao',
'LI' => 'Liechtenstein',
'CY' => 'Cyprus',
'DK' => 'Denmark',
'KZ' => 'Kazakhstan',
'JO' => 'Jordan',
'IT' => 'Italy',
'NL' => 'Netherlands',
'PH' => 'Philippines',
'PT' => 'Portugal',
'CH' => 'Switzerland',
'TW' => 'Taiwan',
'TH' => 'Thailand',
'UZ' => 'Uzbekistan',
'VA' => 'Vatican',
'BE' => 'Belgium',
'EG' => 'Egypt',
'GR' => 'Greece',
'SG' => 'Singapore',
'ES' => 'Spain',
'BN' => 'Brunei',
'HK' => 'Hong Kong',
'ID' => 'Indonesia',
'KR' => 'South Korea',
'NP' => 'Nepal',
'NG' => 'Nigeria',
'PL' => 'Poland',
'SE' => 'Sweden',
'TR' => 'Turkey',
'US' => 'United States',
'ET' => 'Ethiopia',
'GH' => 'Ghana',
'GA' => 'Gabon',
'MG' => 'Madagascar',
'MT' => 'Malta',
'MU' => 'Mauritius',
'MZ' => 'Mozambique',
'RW' => 'Rwanda',
'SO' => 'Somalia',
'SD' => 'Sudan',
'CN' => 'China',
'KE' => 'Kenya',
'PS' => 'Palestinian Territory',
'TZ' => 'Tanzania',
'TN' => 'Tunisia',
'UG' => 'Uganda',
'DJ' => 'Djibouti',
'LS' => 'Lesotho',
'ZM' => 'Zambia',
'ZW' => 'Zimbabwe',
'AM' => 'Armenia',
'BJ' => 'Benin',
'LU' => 'Luxembourg',
'MW' => 'Malawi',
'ML' => 'Mali',
'MA' => 'Morocco',
'SL' => 'Sierra Leone',
'ZA' => 'South Africa',
'BF' => 'Burkina Faso',
'CA' => 'Canada',
'CG' => 'Congo (Brazzaville)',
'CZ' => 'Czech Republic',
'GN' => 'Guinea',
'KG' => 'Kyrgyzstan',
'NA' => 'Namibia',
'NZ' => 'New Zealand',
'TG' => 'Togo',
'UA' => 'Ukraine',
'VN' => 'Vietnam',
'LR' => 'Liberia',
'RU' => 'Russia',
'SY' => 'Syria',
'AL' => 'Albania',
'AD' => 'Andorra',
'AO' => 'Angola',
'EE' => 'Estonia',
'FO' => 'Faroe Islands',
'GI' => 'Gibraltar',
'GL' => 'Greenland',
'LT' => 'Lithuania',
'MV' => 'Maldives',
'MD' => 'Moldova',
'SM' => 'San Marino',
'SN' => 'Senegal',
'SC' => 'Seychelles',
'SK' => 'Slovakia',
'SI' => 'Slovenia',
'BA' => 'Bosnia and Herzegovina',
'BW' => 'Botswana',
'BI' => 'Burundi',
'KH' => 'Cambodia',
'HR' => 'Croatia',
'HU' => 'Hungary',
'IQ' => 'Iraq',
'IE' => 'Ireland',
'IM' => 'Isle of Man',
'CI' => 'Ivory Coast',
'JP' => 'Japan',
'LA' => 'Laos',
'LV' => 'Latvia',
'MM' => 'Myanmar',
'SZ' => 'Eswatini',
'TJ' => 'Tajikistan',
'TM' => 'Turkmenistan',
'YE' => 'Yemen',
'DZ' => 'Algeria',
'AS' => 'American Samoa',
'AI' => 'Anguilla',
'AG' => 'Antigua and Barbuda',
'AR' => 'Argentina',
'AW' => 'Aruba',
'BS' => 'Bahamas',
'BB' => 'Barbados',
'BY' => 'Belarus',
'BZ' => 'Belize',
'BM' => 'Bermuda',
'BT' => 'Bhutan',
'BO' => 'Bolivia',
'TL' => 'Timor-Leste',
'EC' => 'Ecuador',
'SV' => 'El Salvador',
'GQ' => 'Equatorial Guinea',
'FK' => 'Falkland Islands',
'FJ' => 'Fiji',
'FI' => 'Finland',
'GF' => 'French Guiana',
'PF' => 'French Polynesia',
'GM' => 'Gambia',
'GD' => 'Grenada',
'GP' => 'Guadeloupe',
'MH' => 'Marshall Islands',
'MQ' => 'Martinique',
'MR' => 'Mauritania',
'YT' => 'Mayotte',
'MX' => 'Mexico',
'MN' => 'Mongolia',
'ME' => 'Montenegro',
'MS' => 'Montserrat',
'WS' => 'Samoa',
'RS' => 'Serbia',
'SB' => 'Solomon Islands',
'PM' => 'Saint Pierre and Miquelon',
'KN' => 'Saint Kitts and Nevis',
'LC' => 'Saint Lucia',
'VC' => 'Saint Vincent and the Grenadines',
'SR' => 'Suriname',
'SJ' => 'Svalbard and Jan Mayen',
'BR' => 'Brazil',
'BG' => 'Bulgaria',
'CV' => 'Cape Verde',
'KY' => 'Cayman Islands',
'CF' => 'Central African Republic',
'CL' => 'Chile',
'CX' => 'Christmas Island',
'CC' => 'Cocos (Keeling) Islands',
'CO' => 'Colombia',
'KM' => 'Comoros',
'CK' => 'Cook Islands',
'CR' => 'Costa Rica',
'CU' => 'Cuba',
'GU' => 'Guam',
'GT' => 'Guatemala',
'GW' => 'Guinea-Bissau',
'GY' => 'Guyana',
'HT' => 'Haiti',
'HN' => 'Honduras',
'IS' => 'Iceland',
'JM' => 'Jamaica',
'KI' => 'Kiribati',
'NR' => 'Nauru',
'NC' => 'New Caledonia',
'NI' => 'Nicaragua',
'NE' => 'Niger',
'NF' => 'Norfolk Island',
'MP' => 'Northern Mariana Islands',
'NO' => 'Norway',
'PW' => 'Belau',
'PA' => 'Panama',
'PG' => 'Papua New Guinea',
'PY' => 'Paraguay',
'PE' => 'Peru',
'PN' => 'Pitcairn',
'PR' => 'Puerto Rico',
'TO' => 'Tonga',
'TT' => 'Trinidad and Tobago',
'TC' => 'Turks and Caicos Islands',
'TV' => 'Tuvalu',
'UY' => 'Uruguay',
'VU' => 'Vanuatu',
'VE' => 'Venezuela',
'VG' => 'Virgin Islands (British)',
'VI' => 'Virgin Islands (US)',
'EH' => 'Western Sahara',
'DM' => 'Dominica',
'DO' => 'Dominican Republic',
'RE' => 'Reunion',
'RO' => 'Romania',
'GB' => 'United Kingdom', // Added United Kingdom
'GB-NIR' => 'Northern Ireland'
);
// Filter the countries array to only include allowed countries
return array_intersect_key($countries, $allowed_countries);
}Maybe something in the above code is causing the issue but I am not sure what is , and how to solve it…
Will appreciate any help. Ty!
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- You must be logged in to reply to this topic.