How to delete all magento 2 order, invoice, shipment, and credit memo, and reset the increment_id too using php code?


1 Answer 1


Create Magento Module.

or Create php file in that create queries and execute using ajax button placed in admin of magento.

First find out all tables being impacted then you can easily know the SQL queries .

Try using "ALTER TABLE table_name AUTO_INCREMENT = 1;" sql query to reset auto-increment.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.