Time for action—shipping items to selected countries only
In this section, we will learn how to disable country and zone definitions from OpenCart to allow registrations from certain countries only. Let's assume that we will ship products only to US, Canada, UK, and Germany.
There are two methods to enable/disable the countries for shipping.
Manual method
Let's open the System | Localisation | Countries menu. We will Edit the first country, which we will disable.
Let's choose Country Status as Disabled. Let's click on the Save button to finish.
We should repeat this process for all pages of countries which we will not need, one by one. Note that it is a very time consuming process.
Automatic method
We will take advantage of phpMyAdmin database administration tool which we can reach at cPanel. Let's open cPanel which the hosting service has provided for us. Let's click on the phpMyAdmin link.
Note
We should be very careful when applying operations on phpMyAdmin. A wrong operation can damage the whole store structure.
We list the content of the database and see the tables in our OpenCart installation. The information for countries is in the country table. Let's click on the SQL link on the top menu.
Let's write the following SQL statement and click the Go button to execute it:
update country set status=0
This SQL query will disable all countries in the database.
Now, it is easy to enable just a few countries one by one at the administration panel. For example, we would enable the US like in the following screenshot. We will repeat this for the remaining countries—Canada, UK, and Germany in this case.
Now, if we try to register as a new customer, only enabled countries will be listed.