Delete countries and regions

When you delete a country or region, it is no longer available to merchants or shoppers.

Deleting a country automatically deletes all its associated regions.

Before you can delete a country or region, make sure you have removed it from all lists of billing or shipping countries and regions. When you issue the DELETE request, Commerce checks that the countries or regions in the body of the request are not currently referenced in billing or shipping lists. If they are, the request returns an error and the items are not deleted.

To remove a country from your Commerce instance, issue a DELETE request to the ccadmin/v1/countries/deleteCountries endpoint.

The following sample request body removes three countries and all their associated regions from a Commerce instance:

{
    "ids": ["CN", "PK", "LK"]
        }

To remove a region from a country, issue a DELETE request to the /ccadmin/v1/countries/{id}/deleteRegions endpoint, where id is the repositoryId of the country whose regions you want to delete.

For example, to delete three Canadian provinces, issue a DELETE request to the /ccadmin/v1/countries/{CA}/deleteRegions endpoint. The following example shows a sample body for this request:

{
    "ids": ["CA-AB", "CA-SK", "CA-PE"]
 }