Delete sample data
Before adding or importing new data or changing Project configuration, we suggest clearing out the sample data. This guide will walk you through the steps to remove this sample data using both the Merchant Center and the HTTP API.
Delete data in the Merchant Center
To clear sample data using the Merchant Center, follow the list below and remove any unnecessary data:
If you have already added some of your own data or Project configuration (for example, as part of the Project configuration guide), ensure you retain that information if required.
- Cart Discounts
- Categories
- Customers
- Discount Codes
- Product Discounts
- Products
- Project settings:
- Languages, currencies, countries, Zones
- Product Types and Product Attributes
- Shipping Methods
- Stores
- Tax Categories
- Channels
Bulk delete items
For quick removal, the Merchant Center provides a bulk delete feature for Products, Product Discounts, Cart Discounts, and Discount Codes. The following example walks you through the bulk delete process for Products:
- Go to Products > Product list.
- Select the Products you want to bulk delete. You can rely on the filter functionality to narrow down the list.
- Select the checkbox in the Product list's header row to select all the Products on the page.
- You can change the number of Products displayed on the page from the Items per page drop-down at the bottom of the Product list table.
- Select Delete from the Actions drop-down list.
Delete an item manually
To delete items manually in the Merchant Center, follow these steps using Categories as an example:
- Go to Category > Category list and select the Category you want to delete.
- On the Manage Category page, click the delete icon.
Repeat this process for all items you want to delete. The steps might vary slightly depending on the type of item, but the general process is the same.
Delete data using the HTTP API
The following items can be deleted only via the API:
- Carts
- Orders
- Payments
To simplify interacting with the HTTP API, we offer an extensive library of API calls for Postman. Please read our Getting started guide before using Postman.
After setting up the Postman collection, the deletion process is straightforward. You can delete resources by their id
or key
. You also need to provide the latest version
of a resource to delete it. For instance, to delete Carts:
- Open the commercetools Postman collection and go to Authorization > Obtain access token. Click Send to generate a new access token.
- Go to Project > Carts > Query carts to obtain the
id
andversion
of the Cart you want to delete. - Go to Project > Carts > Delete Cart by id.
- In the URL bar, replace placeholders
{{cart-id}}
and{{cart-version}}
with the details of the Cart you want to delete. - Click Send.
Make sure that you delete the right items, as sending a request with Postman is final and does not produce any additional confirmation prompts.
A successful deletion will display the HTTP status code 200, along with the data of the deleted Cart.
Repeat the above for each Cart or item you intend to remove.
Deleting Products and Categories
In the process of deleting your data, there are some specific points to keep in mind for Products and Categories.
- Before deleting Products, you must first unpublish them. To speed up the process, you can rely on bulk actions.
- If you delete a Category that contains subcategories, the subcategories are also removed. In addition, these subcategories are also removed from Products.