I have a bunch of test orders and I'd like to remove them. Is there a way to bulk remove all of the orders without uninstalling/installing the Ubercart module?
Obviously, I'd first backup the database with a simple drush sql-dump
.
I would discourage you from messing with the database unless you really know what you're doing. You should better use the API and the function uc_order_delete()
.
Have a look at this example script:
<?php
include_once './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
global $user;
if ($user->uid == 1) {
$result = db_query("select order_id from uc_orders");
while($row = db_fetch_object($result)){
//# uncomment below to view an order and exit
//# usefull to write a query to only delete certain orders
//print_r($row);
//exit;
print "deleting order $row->order_id\n";
uc_order_delete($row->order_id); // comment this out for testing
}
} else {
print "Only Administrater could deleter orders.";
}
?>
Source: Delete all orders in Ubercart.
You can use a view created with the Views Bulk Operations (VBO) module to delete orders.
This module augments Views by allowing bulk operations to be executed on the displayed rows. It does so by showing a checkbox in front of each node, and adding a select box containing operations that can be applied. Drupal Core or Rules actions can be used.
uc_order_line_items
? It won't bother Drupal to have these lines left in your tables but it's not a good advice to give.