Advertising sustains the DA. Ads are hidden for members. Join today

On this page

Commerce Order Cleanup

Last updated on
18 June 2025

Drupal 7 will no longer be supported after January 5, 2025. Learn more and find resources for Drupal 7 sites

Overview

Commerce Order Cleanup module provides set of drush command to manage deletion of Commerce orders. It allows the user to delete by order status, changed date and type of line item in an order.

For example (with 7.x-1.2) using a Drush command you are able to delete orders containing "Product" product types that have an order status of 'Canceled' and were last changed between 6 and 7 months ago.

Command

  drush coc product --status=canceled --changed_min="-7 months" --changed_max="-6 months"

Variables

To run the above example Drush command, it relies on the user setting up values for the minimum and maximum date range values. The variables are named in the format:

  commerce_order_cleanup_(range_limit)_(product_type)_(order_status) 

Using the previous example command, the following variables should be set:

  commerce_order_cleanup_max_product_canceled
  commerce_order_cleanup_min_product_canceled

The values of those variables are a relative UNIX timestamp.

You can view the full Drush help for the commands by executing the following in your terminal session (which uses the command aliases):

  drush help coc
  drush help cocl

An optional to enable submodule (Commerce Order Cleanup Vars UI) provides the ability to display a list of the currently defined variables that are available for the Commerce Order Cleanup to use.

Help improve this page

Page status: Not set

You can: