{"id":380023,"date":"2023-05-05T09:19:14","date_gmt":"2023-05-05T09:19:14","guid":{"rendered":"https:\/\/webkul.com\/blog\/?p=380023"},"modified":"2023-05-05T09:21:19","modified_gmt":"2023-05-05T09:21:19","slug":"empty-orders-data-in-magento","status":"publish","type":"post","link":"https:\/\/webkul.com\/blog\/empty-orders-data-in-magento\/","title":{"rendered":"How to empty all orders data in magento 2"},"content":{"rendered":"\n<p>Sometimes we needs to reset the complete database of orders and wants to reset the order id to again starts with 1, we can achieve this by executing below set of sql commands.<\/p>\n\n\n\n<p>Note: Take db backup before execution for safe side, as the below commands will delete all order related data permanently.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">SET FOREIGN_KEY_CHECKS = 0;\n\nTRUNCATE TABLE `quote`;\nTRUNCATE TABLE `quote_address`;\nTRUNCATE TABLE `quote_address_item`;\nTRUNCATE TABLE `quote_id_mask`;\nTRUNCATE TABLE `quote_item`;\nTRUNCATE TABLE `quote_item_option`;\nTRUNCATE TABLE `quote_payment`;\nTRUNCATE TABLE `quote_shipping_rate`;\nTRUNCATE TABLE `reporting_orders`;\nTRUNCATE TABLE `sales_bestsellers_aggregated_daily`;\nTRUNCATE TABLE `sales_bestsellers_aggregated_monthly`;\nTRUNCATE TABLE `sales_bestsellers_aggregated_yearly`;\nTRUNCATE TABLE `sales_creditmemo`;\nTRUNCATE TABLE `sales_creditmemo_comment`;\nTRUNCATE TABLE `sales_creditmemo_grid`;\nTRUNCATE TABLE `sales_creditmemo_item`;\nTRUNCATE TABLE `sales_invoice`;\nTRUNCATE TABLE `sales_invoiced_aggregated`;\nTRUNCATE TABLE `sales_invoiced_aggregated_order`;\nTRUNCATE TABLE `sales_invoice_comment`;\nTRUNCATE TABLE `sales_invoice_grid`;\nTRUNCATE TABLE `sales_invoice_item`;\nTRUNCATE TABLE `sales_order`;\nTRUNCATE TABLE `sales_order_address`;\nTRUNCATE TABLE `sales_order_aggregated_created`;\nTRUNCATE TABLE `sales_order_aggregated_updated`;\nTRUNCATE TABLE `sales_order_grid`;\nTRUNCATE TABLE `sales_order_item`;\nTRUNCATE TABLE `sales_order_payment`;\nTRUNCATE TABLE `sales_order_status_history`;\nTRUNCATE TABLE `sales_order_tax`;\nTRUNCATE TABLE `sales_order_tax_item`;\nTRUNCATE TABLE `sales_payment_transaction`;\nTRUNCATE TABLE `sales_refunded_aggregated`;\nTRUNCATE TABLE `sales_refunded_aggregated_order`;\nTRUNCATE TABLE `sales_shipment`;\nTRUNCATE TABLE `sales_shipment_comment`;\nTRUNCATE TABLE `sales_shipment_grid`;\nTRUNCATE TABLE `sales_shipment_item`;\nTRUNCATE TABLE `sales_shipment_track`;\nTRUNCATE TABLE `sales_shipping_aggregated`;\nTRUNCATE TABLE `sales_shipping_aggregated_order`;\nTRUNCATE TABLE `tax_order_aggregated_created`;\nTRUNCATE TABLE `tax_order_aggregated_updated`;\nTRUNCATE TABLE `gift_message`;\nTRUNCATE TABLE `inventory_reservation`;\nTRUNCATE TABLE `sequence_order_0`;\nTRUNCATE TABLE `sequence_order_1`;\nTRUNCATE TABLE `sequence_creditmemo_0`;\nTRUNCATE TABLE `sequence_creditmemo_1`;\nTRUNCATE TABLE `sequence_invoice_0`;\nTRUNCATE TABLE `sequence_invoice_1`;\nTRUNCATE TABLE `sequence_shipment_0`;\nTRUNCATE TABLE `sequence_shipment_1`;\n\nSET FOREIGN_KEY_CHECKS = 1;<\/pre>\n\n\n\n<p>Hope this will be helpful.<\/p>\n\n\n\n<p>Thanks \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sometimes we needs to reset the complete database of orders and wants to reset the order id to again starts with 1, we can achieve this by executing below set of sql commands. Note: Take db backup before execution for safe side, as the below commands will delete all order related data permanently. Hope this <a href=\"https:\/\/webkul.com\/blog\/empty-orders-data-in-magento\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":382,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,302],"tags":[],"class_list":["post-380023","post","type-post","status-publish","format-standard","hentry","category-magento","category-magento2"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to empty all orders data in magento 2 - Webkul Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/webkul.com\/blog\/empty-orders-data-in-magento\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to empty all orders data in magento 2 - Webkul Blog\" \/>\n<meta property=\"og:description\" content=\"Sometimes we needs to reset the complete database of orders and wants to reset the order id to again starts with 1, we can achieve this by executing below set of sql commands. Note: Take db backup before execution for safe side, as the below commands will delete all order related data permanently. Hope this [...]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webkul.com\/blog\/empty-orders-data-in-magento\/\" \/>\n<meta property=\"og:site_name\" content=\"Webkul Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webkul\/\" \/>\n<meta property=\"article:published_time\" content=\"2023-05-05T09:19:14+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-05-05T09:21:19+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-og.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Deepak Tiwari\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webkul\" \/>\n<meta name=\"twitter:site\" content=\"@webkul\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Deepak Tiwari\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/webkul.com\/blog\/empty-orders-data-in-magento\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/empty-orders-data-in-magento\/\"},\"author\":{\"name\":\"Deepak Tiwari\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/ffb460ffefa040a3ac183771c683c2e0\"},\"headline\":\"How to empty all orders data in magento 2\",\"datePublished\":\"2023-05-05T09:19:14+00:00\",\"dateModified\":\"2023-05-05T09:21:19+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/empty-orders-data-in-magento\/\"},\"wordCount\":66,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"articleSection\":[\"magento\",\"Magento2\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/webkul.com\/blog\/empty-orders-data-in-magento\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webkul.com\/blog\/empty-orders-data-in-magento\/\",\"url\":\"https:\/\/webkul.com\/blog\/empty-orders-data-in-magento\/\",\"name\":\"How to empty all orders data in magento 2 - Webkul Blog\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/#website\"},\"datePublished\":\"2023-05-05T09:19:14+00:00\",\"dateModified\":\"2023-05-05T09:21:19+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/webkul.com\/blog\/empty-orders-data-in-magento\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webkul.com\/blog\/empty-orders-data-in-magento\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webkul.com\/blog\/empty-orders-data-in-magento\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to empty all orders data in magento 2\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/webkul.com\/blog\/#website\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"name\":\"Webkul Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/webkul.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/webkul.com\/blog\/#organization\",\"name\":\"WebKul Software Private Limited\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"width\":380,\"height\":380,\"caption\":\"WebKul Software Private Limited\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webkul\/\",\"https:\/\/x.com\/webkul\",\"https:\/\/www.instagram.com\/webkul\/\",\"https:\/\/www.linkedin.com\/company\/webkul\",\"https:\/\/www.youtube.com\/user\/webkul\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/ffb460ffefa040a3ac183771c683c2e0\",\"name\":\"Deepak Tiwari\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/139c61a1c11bbefe6b58eec72b54d4617b170aa4609fc5a038236ac13dbd9c25?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/139c61a1c11bbefe6b58eec72b54d4617b170aa4609fc5a038236ac13dbd9c25?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"caption\":\"Deepak Tiwari\"},\"url\":\"https:\/\/webkul.com\/blog\/author\/deepak-tiwari359\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to empty all orders data in magento 2 - Webkul Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/webkul.com\/blog\/empty-orders-data-in-magento\/","og_locale":"en_US","og_type":"article","og_title":"How to empty all orders data in magento 2 - Webkul Blog","og_description":"Sometimes we needs to reset the complete database of orders and wants to reset the order id to again starts with 1, we can achieve this by executing below set of sql commands. Note: Take db backup before execution for safe side, as the below commands will delete all order related data permanently. Hope this [...]","og_url":"https:\/\/webkul.com\/blog\/empty-orders-data-in-magento\/","og_site_name":"Webkul Blog","article_publisher":"https:\/\/www.facebook.com\/webkul\/","article_published_time":"2023-05-05T09:19:14+00:00","article_modified_time":"2023-05-05T09:21:19+00:00","og_image":[{"width":1200,"height":630,"url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-og.png","type":"image\/png"}],"author":"Deepak Tiwari","twitter_card":"summary_large_image","twitter_creator":"@webkul","twitter_site":"@webkul","twitter_misc":{"Written by":"Deepak Tiwari","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webkul.com\/blog\/empty-orders-data-in-magento\/#article","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/empty-orders-data-in-magento\/"},"author":{"name":"Deepak Tiwari","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/ffb460ffefa040a3ac183771c683c2e0"},"headline":"How to empty all orders data in magento 2","datePublished":"2023-05-05T09:19:14+00:00","dateModified":"2023-05-05T09:21:19+00:00","mainEntityOfPage":{"@id":"https:\/\/webkul.com\/blog\/empty-orders-data-in-magento\/"},"wordCount":66,"commentCount":0,"publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"articleSection":["magento","Magento2"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/webkul.com\/blog\/empty-orders-data-in-magento\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/webkul.com\/blog\/empty-orders-data-in-magento\/","url":"https:\/\/webkul.com\/blog\/empty-orders-data-in-magento\/","name":"How to empty all orders data in magento 2 - Webkul Blog","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/#website"},"datePublished":"2023-05-05T09:19:14+00:00","dateModified":"2023-05-05T09:21:19+00:00","breadcrumb":{"@id":"https:\/\/webkul.com\/blog\/empty-orders-data-in-magento\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webkul.com\/blog\/empty-orders-data-in-magento\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/webkul.com\/blog\/empty-orders-data-in-magento\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to empty all orders data in magento 2"}]},{"@type":"WebSite","@id":"https:\/\/webkul.com\/blog\/#website","url":"https:\/\/webkul.com\/blog\/","name":"Webkul Blog","description":"","publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/webkul.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/webkul.com\/blog\/#organization","name":"WebKul Software Private Limited","url":"https:\/\/webkul.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","width":380,"height":380,"caption":"WebKul Software Private Limited"},"image":{"@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webkul\/","https:\/\/x.com\/webkul","https:\/\/www.instagram.com\/webkul\/","https:\/\/www.linkedin.com\/company\/webkul","https:\/\/www.youtube.com\/user\/webkul\/"]},{"@type":"Person","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/ffb460ffefa040a3ac183771c683c2e0","name":"Deepak Tiwari","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/139c61a1c11bbefe6b58eec72b54d4617b170aa4609fc5a038236ac13dbd9c25?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/139c61a1c11bbefe6b58eec72b54d4617b170aa4609fc5a038236ac13dbd9c25?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","caption":"Deepak Tiwari"},"url":"https:\/\/webkul.com\/blog\/author\/deepak-tiwari359\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/380023","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/users\/382"}],"replies":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/comments?post=380023"}],"version-history":[{"count":3,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/380023\/revisions"}],"predecessor-version":[{"id":380056,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/380023\/revisions\/380056"}],"wp:attachment":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media?parent=380023"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/categories?post=380023"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/tags?post=380023"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}