WooCommerce Country Codes & State Codes List

Here is a list of WooCommerce country code and state code data. This data was extracted directly from the WooCommerce plugin and therefore, can be used for tax rate classes and maybe other WooCommerce related plugins that may require a state code or country code.

Note that while the help text mentions that we should use “2 digit state codes”, I have found that some countries have states codes that are longer than 2 digits. I have tested tax rates for Peru with the 3 letter state code “PAS” and it worked.

I believe that my tax calculations wouldn’t worked without that 3 letter code. While my test passed, I still recommend testing such codes prior to using them on a production site just to be sure.

State
State Code
Yunnan / 云南
CN1
Beijing / 北京
CN2
Tianjin / 天津
CN3
Hebei / 河北
CN4
Shanxi / 山西
CN5
Inner Mongolia / 內蒙古
CN6
Liaoning / 辽宁
CN7
Jilin / 吉林
CN8
Heilongjiang / 黑龙江
CN9
Shanghai / 上海
CN10
Jiangsu / 江苏
CN11
Zhejiang / 浙江
CN12
Anhui / 安徽
CN13
Fujian / 福建
CN14
Jiangxi / 江西
CN15
Shandong / 山东
CN16
Henan / 河南
CN17
Hubei / 湖北
CN18
Hunan / 湖南
CN19
Guangdong / 广东
CN20
Guangxi Zhuang / 广西壮族
CN21
Hainan / 海南
CN22
Chongqing / 重庆
CN23
Sichuan / 四川
CN24
Guizhou / 贵州
CN25
Shaanxi / 陕西
CN26
Gansu / 甘肃
CN27
Qinghai / 青海
CN28
Ningxia Hui / 宁夏
CN29
Macau / 澳门
CN30
Tibet / 西藏
CN31
Xinjiang / 新疆
CN32