How to delete orders after setting up store

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
7 years ago
I'm in the process of testing/setting up a new store, but I would like to remove any of my test orders from the system when I am ready to go live. How can I do this?
7 years ago
you need to make empty Order,OrderItem and OrderNote Tables.
7 years ago
I assume that there is also another table to clean (the items in the order), correct?
7 years ago
I think these three tables are enough.
6 years ago
Use this.

TRUNCATE TABLE OrderNote
DELETE FROM GiftCard
DELETE FROM OrderItem
DELETE FROM [Order]

DBCC CHECKIDENT (OrderNote, RESEED, 0)
DBCC CHECKIDENT (GiftCard, RESEED, 0)
DBCC CHECKIDENT (OrderItem, RESEED, 0)
DBCC CHECKIDENT ([Order], RESEED, 0)
6 years ago
Needs one more table deleted

TRUNCATE TABLE OrderNote
DELETE FROM GiftCard
DELETE FROM OrderItem
DELETE FROM RewardPointsHistory
DELETE FROM [Order]

DBCC CHECKIDENT (OrderNote, RESEED, 0)
DBCC CHECKIDENT (GiftCard, RESEED, 0)
DBCC CHECKIDENT (RewardPointsHistory, RESEED, 0)
DBCC CHECKIDENT (OrderItem, RESEED, 0)
DBCC CHECKIDENT ([Order], RESEED, 0)
4 years ago
Is this still a valid list for nopC 4.1?

TIA...
4 years ago
The better thing to do is create a full database backup BEFORE start your tests, so you are free to test everything as you want. When you finish it, just restore your database backup.

Easy peasy!
4 years ago
True enough, but won't help in my situation.  The info would still be useful.

Thx.
2 years ago
Note: I was trying to do the same thing with a MySQL Database. You can run the following:

SET FOREIGN_KEY_CHECKS=0;

TRUNCATE TABLE `OrderNote`;
TRUNCATE TABLE `GiftCard`;
TRUNCATE TABLE `giftcardusagehistory`;
TRUNCATE TABLE `OrderItem`;
TRUNCATE TABLE `order`;
TRUNCATE TABLE `RewardPointsHistory`;

SET FOREIGN_KEY_CHECKS=1;
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.