• Coding

    Deleting orders in Magento

    Using this blog as reference guide – perhaps slightly easier than bookmarking topics, and in case the internet eats the posts.

    Per this thread, to delete an order, do the following:

    SET @orderId = '100000001';
    
    SET FOREIGN_KEY_CHECKS = 1;
    
    DELETE FROM sales_flat_order
        WHERE increment_id = @orderId;
        
    DELETE FROM sales_flat_quote
        WHERE reserved_order_id = @orderId; 
    

    This works in Magento Community v 1.4.1.0 and Magento Enterprise 1.8.0.0. It deleted all mention of the order from the dashboard/reports.