Providing a clean database is critical when we move to production. During the development phase, testers and developers may add test data for products, customers, orders, items etc for unit testing and system testing. When the website is set to go live, we need to remove the test data.
Clearing the data manually is a tedious and a ‘not-a-proper-way’ of cleaning the database.
The codes below clear the data automatically reducing the effort of the developers and also providing a clean database for production.
Just in case, please take a backup of your test DB before applying this code.
Delete Cart Items:
Code to delete the Orders, Invoice, Credit Memo and Shipment programmatically in Magento 2:
Hope the code was useful. Please share us your feedback and comments.
Is your Magento store healthy? Our experts are here to help you with our Magento services for your store. Get in Touch