cancel
Showing results for 
Search instead for 
Did you mean: 

Changing order status

Changing order status

I'm getting an error indicating I can't change order statuses because of existing orders which makes sense.

 

This is a dev setup moving to live soon and I need to alter the order statuses - is there a good way to remove all orders (since they're just test anyway) so that I can alter the order statuses?  This is 2.2.5 EE.

4 REPLIES 4

Re: Changing order status

Hello,

 

run below query

 

# Clean order infos
TRUNCATE TABLE `sales_creditmemo`;
TRUNCATE TABLE `sales_creditmemo_comment`;
TRUNCATE TABLE `sales_creditmemo_grid`;
TRUNCATE TABLE `sales_creditmemo_item`;
TRUNCATE TABLE `sales_invoice`;
TRUNCATE TABLE `sales_invoiced_aggregated`;
TRUNCATE TABLE `sales_invoiced_aggregated_order`;
TRUNCATE TABLE `sales_invoice_comment`;
TRUNCATE TABLE `sales_invoice_grid`;
TRUNCATE TABLE `sales_invoice_item`;
TRUNCATE TABLE `sales_order`;
TRUNCATE TABLE `sales_order_address`;
TRUNCATE TABLE `sales_order_aggregated_created`;
TRUNCATE TABLE `sales_order_aggregated_updated`;
TRUNCATE TABLE `sales_order_grid`;
TRUNCATE TABLE `sales_order_item`;
TRUNCATE TABLE `sales_order_payment`;
TRUNCATE TABLE `sales_order_status_history`;
TRUNCATE TABLE `sales_order_tax`;
TRUNCATE TABLE `sales_order_tax_item`;
TRUNCATE TABLE `sales_payment_transaction`;
TRUNCATE TABLE `sales_refunded_aggregated`;
TRUNCATE TABLE `sales_refunded_aggregated_order`;
TRUNCATE TABLE `sales_shipment`;
TRUNCATE TABLE `sales_shipment_comment`;
TRUNCATE TABLE `sales_shipment_grid`;
TRUNCATE TABLE `sales_shipment_item`;
TRUNCATE TABLE `sales_shipment_track`;
TRUNCATE TABLE `sales_shipping_aggregated`;
TRUNCATE TABLE `sales_shipping_aggregated_order`;

# Clean cart infos
TRUNCATE TABLE `quote`;
TRUNCATE TABLE `quote_address`;
TRUNCATE TABLE `quote_address_item`;
TRUNCATE TABLE `quote_id_mask`;
TRUNCATE TABLE `quote_item`;
TRUNCATE TABLE `quote_item_option`;
TRUNCATE TABLE `quote_payment`;
TRUNCATE TABLE `quote_shipping_rate`;

# EE Related extra tables
TRUNCATE TABLE `magento_sales_creditmemo_grid_archive`;
TRUNCATE TABLE `magento_sales_invoice_grid_archive`;
TRUNCATE TABLE `magento_sales_order_grid_archive`;
TRUNCATE TABLE `magento_sales_shipment_grid_archive`;
TRUNCATE TABLE `magento_customercustomattributes_sales_flat_order`;
TRUNCATE TABLE `magento_customercustomattributes_sales_flat_order_address`;
TRUNCATE TABLE `magento_customercustomattributes_sales_flat_quote`;
TRUNCATE TABLE `magento_customercustomattributes_sales_flat_quote_address`;
TRUNCATE TABLE `magento_rma`;
TRUNCATE TABLE `magento_rma_grid`;
TRUNCATE TABLE `magento_rma_item_entity`;
TRUNCATE TABLE `magento_rma_item_entity_datetime`;
TRUNCATE TABLE `magento_rma_item_entity_decimal`;
TRUNCATE TABLE `magento_rma_item_entity_int`;
TRUNCATE TABLE `magento_rma_item_entity_text`;
TRUNCATE TABLE `magento_rma_item_entity_varchar`;
TRUNCATE TABLE `magento_rma_shipping_label`;
TRUNCATE TABLE `magento_rma_status_history`;
TRUNCATE TABLE `negotiable_quote`;
TRUNCATE TABLE `negotiable_quote_comment`;
TRUNCATE TABLE `negotiable_quote_comment_attachment`;
TRUNCATE TABLE `negotiable_quote_grid`;
TRUNCATE TABLE `negotiable_quote_history`;
TRUNCATE TABLE `negotiable_quote_item`;
TRUNCATE TABLE `negotiable_quote_purged_content`;
TRUNCATE TABLE `quote_preview`;
TRUNCATE TABLE `signifyd_case`;
TRUNCATE TABLE `temando_checkout_address`;
TRUNCATE TABLE `temando_order`;
TRUNCATE TABLE `temando_shipment`;

# Reset indexes (if you want your orders number start back to 1
TRUNCATE TABLE `sequence_invoice_0`;
TRUNCATE TABLE `sequence_invoice_1`;
TRUNCATE TABLE `sequence_invoice_2`;
TRUNCATE TABLE `sequence_invoice_3`;
TRUNCATE TABLE `sequence_invoice_4`;

TRUNCATE TABLE `sequence_order_0`;
TRUNCATE TABLE `sequence_order_1`;
TRUNCATE TABLE `sequence_order_2`;
TRUNCATE TABLE `sequence_order_3`;
TRUNCATE TABLE `sequence_order_4`;

TRUNCATE TABLE `sequence_shipment_0`;
TRUNCATE TABLE `sequence_shipment_1`;
TRUNCATE TABLE `sequence_shipment_2`;
TRUNCATE TABLE `sequence_shipment_3`;
TRUNCATE TABLE `sequence_shipment_4`;

TRUNCATE TABLE `sequence_creditmemo_0`;
TRUNCATE TABLE `sequence_creditmemo_1`;
TRUNCATE TABLE `sequence_creditmemo_2`;
TRUNCATE TABLE `sequence_creditmemo_3`;
TRUNCATE TABLE `sequence_creditmemo_4`;

# EE Reset indexes (if you want your orders number start back to 1
TRUNCATE TABLE `sequence_rma_item_0`;
TRUNCATE TABLE `sequence_rma_item_1`;
TRUNCATE TABLE `sequence_rma_item_2`;
TRUNCATE TABLE `sequence_rma_item_3`;
TRUNCATE TABLE `sequence_rma_item_4`;

regarding to sequence table it is store wise.

 

hope it will help you.

 

if works then mark as solution


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer

Re: Changing order status

Hello @joseph_digiovanna

Delete all the Orders using this free extension from us

https://magecomp.com/magento-2-delete-orders.html

Was my answer helpful? You can accept it as a solution.
175+ Professional Extensions for M1 & M2
Need a developer?Just visit Contact Us Now

Re: Changing order status

Hi @joseph_digiovanna

 

Since you are moving to production server soon so you need to delete the test orders. So here are few extensions available which is paid for EE. Listed down here so you check:

  1. https://www.mageplaza.com/magento-2-delete-orders/
  2. https://www.wyomind.com/magento2/order-eraser-magento.html#compatibility
  3. https://magecomp.com/magento-2-delete-orders.html

If issue solved,Click Kudos & Accept as Solution

Re: Changing order status

MageAnts offer Free Magento 2 Delete Orders extension for magento 2 store start free download now