User Tools

Site Tools


Sidebar

magento_2:delete_order

For more details see the Delete Order for Magento 2 extension page.

Ultimate Guide for Magento 2 Delete Order

Upgrade your Magento 2 store order processing functionality with the Delete Order extension. Delete particular orders and all related information. Also, you can move them to archive where order data can be stored and then returned to the order grid.

  • Completely remove any orders
  • Archive unnecessary orders manually or automatically
  • Set order archiving schedule
  • Restore archive orders and related data
  • Configure email notifications to store admins

General Settings

To configure general extension settings please go to StoresConfigurationOrder Archive
Check the most common use cases in this video:

Enable Orders Archive - Ser the option to 'yes' to activate the extension.

Hide Archived Orders on Frontend - Enable the option to remove archived orders from customer accounts.

Archive Orders Older Than- Specify the number of days before orders get archived.

Order Status to Apply to - Choose order statuses which should be archived. You can select multiple statuses at a time.

Archive Frequency - Choose one of 5 predefined options for archive frequency:

  • Hourly
  • Two times per day
  • Daily
  • Weekly
  • Monthly

Email Notifications

Notify after archiving is complete - Enable this option to inform your store administrator about each successful archive run.

Send to e-mail address - specify the email address to which notifications will be sent.

E-mail template - specify an email template for admin notifications. You can either choose the default one, you use your custom template.

To add a new template please go to MarketingCommunicationsEmail Templates.

Force Cron Job

Due to this option you can initiate an archiving process at any time you need regardless your archive schedule.

Archive Orders

To archive specific orders manually please go to the orders grid: SalesOrders. IMPORTANT: All archived orders can be restored and returned to the Orders Grid.

Select Orders that should be archived and apply the 'Archive Orders' action. Once the action is applied all archived orders will be placed to a special Archived Orders grid.

Delete Orders Permanently

To delete orders permanently please go to the orders grid: SalesOrders. IMPOERANT: deletd orders can't be restored.

Select the orders you want to delete on the Orders Grid and apply the corresponding action.

Manage Archived Orders

All archived orders are placed to the Order Archive grid. To open the grid please go to SalesOrder ArchivesOrders.

Export Archived Orders - you can export all archived orders for further processing to CSV or XML files.

On the Order Archive grid you can either delete any orders permanently or restore them.

Remove from Archive - apply this action to restore archive orders. All restored orders will be displayed on the Orders Grid.

Delete Permanently - choose this action to deleted selected archive orders.

You can easily open any archived order to see its details. To open an order click the View link in the right column on the grid.

It's possible to restore any archived order right from the Order Info page.

Working with API

With the Order Archive for Magento 2 extension, you can manage your order archive using API. There are 3 operations you are able to perform. These are:

  • Move to archive;
  • Return from archive;
  • Permanently remove an order.

Let's dig into examples.

Move to archive

Operation: V1/amastyMoveToArchive

Description: Operation moves orders and order-related entities to archive tables amastyorderarchive%. Operation affects all the entities associated with the order: invoices, credit memos, shippings if they exist for the order.

Method: POST

Required:

orderids=(Array[integer])
example: orderids=12,1,4,5

Example:

		{
		  "orderIds": [
		   1, 4,5,12
		  ]
		}
Success response code: 200
Success response:
{
  "order_ids": [
    1,
    4,
    5,
    12
  ],
  "invoice_ids": [
    1
  ],
  "creditmemo_ids": [
    4
  ],
  "shipment_ids": [
    1,
    12
  ]
}

Error Response: 401 code – Unauthorized, 400 – unexpected error

Does not check the order existence in the database, if the order does not exist return code 200.

Move from archive

Operation: /V1/amastyMoveFromArchive

Description: Operation moves orders and order-related entities from archive tables “amastyorderarchive%”. Operation affect all the entities associated with the order: invoices, credit memos, shippings if they exist for the order.

Method: POST

Required:

orderids=(Array[integer])
example: orderids=12,1,4,5

Example:

		{
		  "orderIds": [
		   1, 4,5,12
		  ]
		}
Success response code: 200
Success response:
{
  "order_ids": [
    1,
    4,
    5,
    12
  ],
  "invoice_ids": [
    1
  ],
  "creditmemo_ids": [
    4
  ],
  "shipment_ids": [
    1,
    12
  ]
}

Error Response: 401 code – Unauthorized, 400 – unexpected error

Does not check the order existence in the database, if the order does not exist return code 200.

Remove completely

Operation: /V1/amastyRemovePermanently

Description: Completely removes orders and related data from the database without the possibility of their recovery.

Method: POST

Required: orderids=(Array[integer])

Example:

orderids=12,1,4,5

Success response code: 200
Success response:
{
  "order_ids": [
    "[\"5\"]"
  ],
  "invoice_ids": null,
  "creditmemo_ids": null,
  "shipment_ids": null
}

Error Response: 401 code – Unauthorized, 400 – unexpected error

Does not check the order existence in the database, if the order does not exist return code 200.
Find out how to install the Delete Order extension for Magento 2 via Composer.

Rate the user guide
 stars  from 3 votes (Details)
magento_2/delete_order.txt · Last modified: 2020/10/14 08:56 by asemenova