If you want to add a new country that is not yet in the list of Supported Countries, please follow this guide to send a pull request.
- Fork the plugin repository on your GitHub account.
- Refer to WooCommerce country codes to find the code related to your country. E.g.
'NG'
for Nigeria,'ES'
for Spain,'VE'
for Venezuela. - Duplicate (DO NOT EDIT DIRECTLY!) the
XX.php
file you'll find insidetemplate/states/
andtemplate/places/
, rename them with the code of your country you found in the previous step (E.g.NG.php
,ES.php
,VE.php
) and move them totrunk/states
andtrunk/places/
respectively.
# Please remember:
- Do not edit the templates files directly:
+ Duplicate them in their respective folder (trunk/states/ & trunk/places/) and then update the country code.
- Go to the
states/
directory and open the file you just move fromtemplate/states/
with your favourite code editor. - Find the
$states['XX']
(line 19) and replace'XX'
with your country code. - Some countries like Denmark or Belgium do not use the state field. If your country doesn't use it either, leave the array empty to disable the State field:
// Disable the State field
$states['DK'] = array();
Otherwise, if the state field is used in your country, start adding your Country States: Add a Code to each State using a logic sense (E.g. 'FA' => 'Florida'
). This code will be used to map the Places beloging this State. You can use any standar like ISO, ANSI, etc. There is no an mandatory standar or system and you can use your own. Please see the U.S. state abbreviations to see an example.
- Edit the header comment with your credits and the source(s) link(s) where you got the info of Places. We'll check the list before accept your pull request. You should also remove all the comments after line 17 (that is a resume of this guide to ease the job).
Your code should look like this:
$states['VE'] = array(
'AM' => 'Amazonas',
'AN' => 'Anzoátegui',
'AP' => 'Apure',
'AR' => 'Aragua',
[...]
);
Note: "States" is the generic name equivalent to first-level administrative divisions likes States, Provinces, Regions, Departments or whatever this subdivision is called in your country.
- Go to the
places/
directory and open the file you just move fromtemplate/places/
with your favourite code editor. - Find
$places['XX']
(line 19) and replace'XX'
with your country code. - Find
'AA' => array(
(line 19) and replace'AA'
with the first State Code you entered in thestates
file in the previous section. - Begin adding the State places: Add a place per line as follows:
'Location 1', 'Location 2', 'Location 3', [...]
- Repeat steps 3 and 4 as many times as States you entered in the
states
file in the previous section. - Edit the header comment with your credits and the source(s) link(s) where you got the info of Places. We'll check the list before accept your pull request. You should also remove all the comments after line 17 (that is a resume of this guide to ease the job).
Your code should look like this:
$places['VE'] = array(
'AM' => array(
'Alto Orinoco (La Esmeralda)',
'Atabapo (San Fernando de Atabapo)',
[...]
),
'AN' => array(
'Anaco (Anaco)',
'Aragua (Aragua de Barcelona)',
[...]
),
'AP' => array(
'Achaguas (Achaguas)',
'Biruaca (Biruaca)',
[...]
),
'AR' => array(
'Bolívar (San Mateo)',
'Camatagua (Camatagua)',
[...]
),
[...]
);
Note: "Places" is the generic name equivalent to second-level administrative divisions likes Cities, Municipalities, Districts, Communes or whatever this subdivision is called in your country.
If you completed the steps above, you're ready to send a pull request. Thanks in advance for your contribution to improve this plugin.
If your don't know or don't want to use GitHub workflow, please follow the following steps to add your country to the plugin:
- Click here to download the
wc-states-places-country-templates.zip
file. - Uncompress and edit both
template/states/XX.po
andtemplate/places/XX.po
, adding the location data for your country. - Send the files to this email: [email protected].
- Thanks in advance for your contribution to improve this plugin.