World's THINNEST Laptop »

How to Remove Country from ZenCart

Suppose you have a ZenCart eCommerce site that will only ship within your own country. Whenever a customer registers on your site, they will need to enter their address where they have to scroll through a list of over 200 countries.

In this tutorial example, we will show you how to remove all the countries from this drop so that only the country "United States" is shown. By removing the other countries, you will let your customer know that you ship only to this one country. This avoids the situation when a customer orders and pay for a product only later to find out that you do not ship there.

1. The normal way of deleting the country is to go to "ZenCart admin -> Location -> Countries", select the country, click Delete, and confirm the delete.

2. Since the first method is quite time-consuming, you can also delete the countries directly from the ZenCart database if you feel comfortable doing that and have access to phpMyAdmin (a database administration tool available on many webhosts). Backup your database before attempting.

a. Go to the ZenCart database using phpMyAdmin and browse the table "countries" to find the countries_id that we want to keep.

in this case "United States" is countries_id 223.

b. Click the SQL tab, and enter the query "DELETE FROM countries WHERE countries_id <> '223';"

Depending on how you install ZenCart, your table name may have a prefix (such as "zen_"). In that case you would alter the SQL query statement to match your table name. So if your table name is "zen_countries" instead of "countries", then the SQL statement would be "DELETE FROM zen_countries WHERE countries_id <> '223';"

c. Browse table again to see that only country present is United States and drop list now shows ...