How can I restrict or limit the Country values that are shown to the user when creating an account or entering an address on my site?

PRESSERO > *Pressero FAQs
It is possible to limit the countries shown on the Country drop-down selector when a visitor is creating a new account, adding/editing an address on the site, using a shipping estimator on the product page, setting country on the shopping cart page and the country selector on the guest checkout page. This can be done by adding the script code below to the head content section of your site.
 
When adding CSS or JavaScript to change the design or behavior of a Pressero site, please keep in mind that the underlying HTML may change as new features are introduced to the system and any CSS or JavaScript added may stop working at any time.
 
The example code below, finds specific select boxes or drop downs for country selection on the site and removes all countries NOT specified in the "allowedCountries" array.
 
The code below can be added to a Pressero site, by pasting the code in Settings > SEO & HTML > Head Content.
 
After pasting the code edit the "allowedCountries" array (in bold) to list all the countries you want to be kept in the select boxes. The example below is only allowing United States of America and Canada. The country name must be entered into the array with exact spelling and case as it appears in the country drop-downs on the site. See full list of countries below.
 
The code below will not work with a custom skin as on most custom skins the initCalcFinish() function is used for other features. If you have a custom skin custom code will need to be created for the skin.
 
<script>
    //Limit country: https://support.aleyant.com/kb/a1364/how-can-i-restrict-limit-country-values-that-are-shown-to-user-when-creating-an-account.aspx#
    
    var allowedCountries = ["United States of America", "Canada"];
    var kendoInterval = setInterval(limitCountrySelection, 500);
    function limitCountrySelection() {
        //console.log("limit country");
        //product page esitmate shipping select box
        $('#ddlCountryCode, #countryCode').find('option').each(function () {
            if ($.inArray($(this).text().trim(), allowedCountries) < 0) {
                $(this).remove();
                clearInterval(kendoInterval);
                //console.log("select");
            }
        });

        //create account kendo drop down
        $('#Address_Country-list, #Country_listbox, #billingCountry_listbox, #shippingCountry_listbox, #Country-list').find('li').each(
            function () {
                if ($.inArray($(this).text().trim(), allowedCountries) < 0) {
                    $(this).hide();
                    clearInterval(kendoInterval);
                    //console.log("kendo drop");
                }
            });
    }

    //intCalcFinish will fire when pricing engine is changed
    function intCalcFinish() {
        if ($('#ddlCountryCode')) {
            limitCountrySelection();
        }
    }

    //will fire on page ready
    $(function () {
        limitCountrySelection();
    });
</script>



 
 
Here is a full list of all the countries listed in the Country drop downs across all Pressero sites.
Afghanistan
Åland
Albania
Algeria
American Samoa
Andorra
Angola
Anguilla
Antarctica
Antigua and Barbuda
Argentina
Armenia
Aruba
Australia
Austria
Azerbaijan
Bahamas
Bahrain
Bangladesh
Barbados
Belarus
Belgium
Belize
Benin
Bermuda
Bhutan
Bolivia
Bosnia and Herzegovina
Botswana
Bouvet Island
Brazil
British Indian Ocean Territory
Brunei Darussalam
Bulgaria
Burkina Faso
Burundi
Cambodia
Cameroon
Canada
Cape Verde
Cayman Islands
Central African Republic
Chad
Chile
China
Christmas Island
Cocos (Keeling) Islands
Colombia
Comoros
Congo (Brazzaville)
Congo (Kinshasa)
Cook Islands
Costa Rica
Côte d'Ivoire
Croatia
Cuba
Curaçao
Cyprus
Czech Republic
Denmark
Djibouti
Dominica
Dominican Republic
Ecuador
Egypt
El Salvador
Equatorial Guinea
Eritrea
Estonia
Ethiopia
Falkland Islands
Faroe Islands
Fiji
Finland
France
French Guiana
French Polynesia
French Southern Lands
Gabon
Gambia
Georgia
Germany
Ghana
Gibraltar
Greece
Greenland
Grenada
Guadeloupe
Guam
Guatemala
Guernsey
Guinea
Guinea-Bissau
Guyana
Haiti
Heard and McDonald Islands
Honduras
Hong Kong
Hungary
Iceland
India
Indonesia
Iran
Iraq
Ireland
Isle of Man
Israel
Italy
Jamaica
Japan
Jersey
Jordan
Kazakhstan
Kenya
Kiribati
Korea, North
Korea, South
Kuwait
Kyrgyzstan
Laos
Latvia
Lebanon
Lesotho
Liberia
Libya
Liechtenstein
Lithuania
Luxembourg
Macau
Macedonia
Madagascar
Malawi
Malaysia
Maldives
Mali
Malta
Marshall Islands
Martinique
Mauritania
Mauritius
Mayotte
Mexico
Micronesia
Moldova
Monaco
Mongolia
Montenegro
Montserrat
Morocco
Mozambique
Myanmar
Namibia
Nauru
Nepal
Netherlands
Netherlands Antilles
New Caledonia
New Zealand
Nicaragua
Niger
Nigeria
Niue
Norfolk Island
Northern Mariana Islands
Norway
Oman
Pakistan
Palau
Palestine
Panama
Papua New Guinea
Paraguay
Peru
Philippines
Pitcairn
Poland
Portugal
Puerto Rico
Qatar
Reunion
Romania
Russian Federation
Rwanda
Saint Barthélemy
Saint Helena
Saint Kitts and Nevis
Saint Lucia
Saint Martin (French part)
Saint Pierre and Miquelon
Saint Vincent and the Grenadines
Samoa
San Marino
Sao Tome and Principe
Saudi Arabia
Senegal
Serbia
Seychelles
Sierra Leone
Singapore
Slovakia
Slovenia
Solomon Islands
Somalia
South Africa
South Georgia and South Sandwich Islands
Spain
Sri Lanka
Sudan
Suriname
Svalbard and Jan Mayen Islands
Swaziland
Sweden
Switzerland
Syria
Taiwan
Tajikistan
Tanzania
Thailand
Timor-Leste
Togo
Tokelau
Tonga
Trinidad and Tobago
Tunisia
Turkey
Turkmenistan
Turks and Caicos Islands
Tuvalu
Uganda
Ukraine
United Arab Emirates
United Kingdom
United States Minor Outlying Islands
United States of America
Uruguay
Uzbekistan
Vanuatu
Vatican City
Venezuela
Vietnam
Virgin Islands, British
Virgin Islands, U.S.
Wallis and Futuna Islands
Western Sahara
Yemen
Zambia
Zimbabwe