Download the PHP package mage2kishan/module-order-cleanup without Composer

On this page you can find all versions of the php package mage2kishan/module-order-cleanup. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package module-order-cleanup

Magento 2 Order Cleanup

Panth Order Cleanup (module Panth_OrderCleanup) adds order deletion to the Magento 2 admin. Magento does not ship with a way to delete orders. This module adds a delete button to the order view page and a mass action to the order grid, both guarded by ACL resources, an optional list of allowed order statuses, a confirmation step and an audit log table. It is an admin-only module with no storefront code. It is used by store owners, developers and agencies who need to remove test, spam or otherwise unwanted orders from a store.

Deletions are permanent: the module deletes rows from the Magento sales and quote tables inside a database transaction and there is no undo, so back up the database before using it on real order data.

Product page: kishansavaliya.com/magento-2-order-cleanup.html

Features

Compatibility

Platform Versions
Magento Open Source 2.4.4, 2.4.5, 2.4.6, 2.4.7, 2.4.8
Adobe Commerce 2.4.4, 2.4.5, 2.4.6, 2.4.7, 2.4.8
PHP 8.1, 8.2, 8.3, 8.4

Composer constraints from composer.json: magento/framework ^103.0, magento/module-sales ^103.0, magento/module-backend ^102.0, magento/module-ui ^101.2.

Requirements

Installation

Notes:

Check the result with:

Configuration

Go to Stores > Configuration > Panth Extensions > "Order Cleanup". Every setting is defined at the default (global) scope only; there are no website or store view overrides. All configuration paths start with panth_order_cleanup/. The section is protected by the ACL resource Panth_OrderCleanup::config, and the same page is reachable from the "Order Cleanup" > "Configuration" admin menu item.

General

Setting Default What it does
Enable Order Cleanup (general/enabled) Yes Master switch. When No, the delete button is hidden and every delete request, single or mass, is refused with an error message.

Delete Button on Order View

Setting Default What it does
Show Delete Button on Order View (button/show_on_order_view) Yes Adds the delete button to the order detail page.
Button Text (button/button_text) Delete This Order Text shown on the button. Shown only when the previous setting is Yes.
Button Color (button/button_color) #DC2626 Hex background colour of the button (#RGB or #RRGGBB). Any other value falls back to #DC2626. Shown only when "Show Delete Button on Order View" is Yes.

Safety & Data Controls

Setting Default What it does
Require Confirmation Modal (safety/require_confirmation) Yes Opens the confirmation modal when the delete button is clicked. When No and "Require Typing Order ID to Confirm" is also No, the browser's native confirm dialog is used instead. When typing the order ID is required, the modal is always shown.
Require Typing Order ID to Confirm (safety/require_type_order_id) Yes The confirm button in the modal stays disabled until the typed value equals the order increment ID. The delete controller also compares the submitted value with the order increment ID and refuses the request if they differ. Applies to the order view button only, not to the mass action.
Delete Related Invoices (safety/delete_invoices) Yes Deletes the order's invoices with their items, comments and grid rows. When No, an order that has invoices is refused, because the database foreign keys would remove the invoices together with the order.
Delete Related Shipments (safety/delete_shipments) Yes Deletes the order's shipments with their items, comments and grid rows. When No, an order that has shipments is refused.
Delete Related Credit Memos (safety/delete_creditmemos) Yes Deletes the order's credit memos with their items, comments and grid rows. When No, an order that has credit memos is refused.
Delete Related Payment Transactions (safety/delete_transactions) Yes Deletes rows from sales_payment_transaction for the order. When No, an order that has payment transactions is refused.
Keep Deletion Log (safety/keep_deletion_log) Yes Writes a row to panth_order_deletion_log for each deletion, inside the same transaction as the deletion.
Allowed Order Statuses for Deletion (safety/allowed_statuses) canceled, closed, holded, pending, fraud Multiselect of order statuses. Only orders whose current status is in the list can be deleted. Empty means all statuses are allowed.

Mass Delete

Setting Default What it does
Enable Mass Delete Action (mass_action/enabled) Yes When No, the "Delete Orders (Permanent)" entry is removed from the grid Actions dropdown and the mass delete controller refuses the request with an error message.
Require Confirmation for Mass Delete (mass_action/require_confirmation) Yes When Yes, a confirmation dialog is shown before the mass delete request is sent. When No, the request is sent without the dialog.
Maximum Orders Per Mass Action (mass_action/max_orders_per_action) 50 If more orders than this are selected, nothing is deleted and an error message reports the limit.

Default behaviour after installation: the module is enabled, the button and the mass action are active, all related documents and transactions are deleted together with the order, the deletion log is kept, and only orders in the statuses canceled, closed, holded, pending or fraud can be deleted.

Usage

There is no automatic, scheduled or age-based deletion and no store filter. Orders are only deleted when an admin user explicitly chooses them; the module registers no cron jobs and no console commands.

Selection criteria

Panth\OrderCleanup\Model\OrderDeleter::deleteOrder() applies the same checks to every order, whether it comes from the order view button or from the mass action:

  1. "Enable Order Cleanup" must be Yes.
  2. The order must exist (loaded through OrderRepositoryInterface).
  3. If "Allowed Order Statuses for Deletion" is not empty, the order's current status must be one of the listed statuses.
  4. If any of "Delete Related Invoices", "Delete Related Shipments", "Delete Related Credit Memos" or "Delete Related Payment Transactions" is No, the order must not have documents of that type.

The controllers additionally require the ACL resources Panth_OrderCleanup::delete_order (single) or Panth_OrderCleanup::mass_delete (mass), and the mass action requires "Enable Mass Delete Action" to be Yes and the selection to be within "Maximum Orders Per Mass Action". When "Require Typing Order ID to Confirm" is Yes, the single delete controller also requires the posted confirm_increment_id value to equal the order increment ID.

Deleting a single order

  1. Open Sales > Orders and view an order. The button is shown only when the module is enabled, "Show Delete Button on Order View" is Yes and the admin user has Panth_OrderCleanup::delete_order.
  2. Click the button. With the confirmation modal enabled, a dialog lists what will be removed; with "Require Typing Order ID to Confirm" enabled, type the order increment ID to activate "Yes, Permanently Delete". Cancel, Escape or a click outside the dialog closes it and clears the typed value.
  3. Confirm. The form posts to panth_ordercleanup/order/delete and you are redirected to the order grid with a success or error message.

Deleting orders in bulk

  1. In Sales > Orders select the orders and choose "Delete Orders (Permanent)" from the Actions dropdown.
  2. Confirm the dialog. The request posts to panth_ordercleanup/order/massDelete.
  3. Each selected order is processed one by one with the checks above. Orders that fail a check are skipped and the others are still deleted. The result message reports how many orders were deleted and how many could not be, with the reasons.

What is deleted

For every order that passes the checks, the following rows are deleted inside one transaction, in this order:

Data Tables Condition
Invoices sales_invoice_item, sales_invoice_comment, sales_invoice_grid, sales_invoice "Delete Related Invoices" = Yes
Shipments sales_shipment_item, sales_shipment_comment, sales_shipment_grid, sales_shipment "Delete Related Shipments" = Yes
Credit memos sales_creditmemo_item, sales_creditmemo_comment, sales_creditmemo_grid, sales_creditmemo "Delete Related Credit Memos" = Yes
Payment transactions sales_payment_transaction "Delete Related Payment Transactions" = Yes
Order data sales_order_tax_item (for the order's tax rows), sales_order_item, sales_order_payment, sales_order_status_history, sales_order_address, sales_order_tax, sales_order_grid, sales_order Always
Quote quote_shipping_rate (for the quote's addresses), quote_item, quote_address, quote_payment, quote Always, when the order has a quote_id

The deletes are issued directly on the database connection, not through Magento repositories. Inside the transaction the module dispatches the sales_order_delete_before and sales_order_delete_after events with the order as order and data_object; an exception thrown by an observer rolls the deletion back. Plugins on the order repository or order resource model do not run. Rows in other tables are removed only if the database schema cascades on foreign keys; rows written by third-party extensions without such constraints are left in place. If any statement fails, the transaction is rolled back and nothing is deleted.

Deletion log

When "Keep Deletion Log" is Yes, a row is inserted into panth_order_deletion_log inside the deletion transaction, so an order is never deleted without its log row. The log data is captured before deletion and keeps: order increment ID and entity ID, customer name and email, grand total and currency, status at deletion, item count and a JSON summary of the visible items (name, SKU, quantity, price), whether invoices, shipments and credit memos were deleted (Yes only when the order had such documents), the admin user name, the admin's IP address, the method (single or mass) and the deletion timestamp.

The grid is at "Order Cleanup" > "Deletion Log" in the admin menu (route panth_ordercleanup/log/index, ACL Panth_OrderCleanup::view_log). It supports filtering, sorting, column selection, paging and bookmarks. The grid shows all logged fields except the entity ID, currency and JSON summary; Grand Total is shown in the currency of the deleted order. Email and IP Address are hidden by default and can be shown from Columns.

System log

Each successful deletion writes an info entry and each failure writes an error entry to the Magento logger, prefixed with Panth_OrderCleanup:. If the deletion log row cannot be written, the whole deletion is rolled back and logged as an error.

Developer Notes

Uninstallation

These steps do not drop the panth_order_deletion_log table and do not remove the panth_order_cleanup/* rows from core_config_data; delete them manually if you no longer need the audit history. Orders that were deleted with the module are not restored.

Support

License

Free and open source under the MIT License. See LICENSE.txt.

Changelog

See CHANGELOG.md.

Links


All versions of module-order-cleanup with dependencies

PHP Build Version
Package Version
Requires php Version ~8.1.0||~8.2.0||~8.3.0||~8.4.0
magento/framework Version ^103.0
magento/module-sales Version ^103.0
magento/module-backend Version ^102.0
magento/module-ui Version ^101.2
mage2kishan/module-core Version ^1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package mage2kishan/module-order-cleanup contains the following files

Loading the files please wait ...