2

I need to delete 200 Drupal commerce orders. Is there any way to do this in a bulk action?

Orders are at: /admin/commerce/orders

Same with Customer profiles. I need to delete them with a bulk action. Can I accomplish with this?

Customer profiles are at: /admin/commerce/customer-profiles/list

3 Answers 3

4

There is a module for that™

With Commerce VBO views you can create a view where you can mass delete orders and products. I don't know about customer profiles, but that could be a feature request if it's not added yet.

5
  • You trademarked it! A definite +1!
    – Clive
    Feb 13, 2012 at 9:33
  • Thanks, I'll check that module. Just wondering... what if I just use the VBO module to add a vbo fiel to the main orders view. Is this bad practice?
    – chefnelone
    Feb 13, 2012 at 9:37
  • @chefnelone What do you mean by a VBO field?
    – googletorp
    Feb 13, 2012 at 10:44
  • please, look a the image capture screencast.com/t/WgyeeSQyG
    – chefnelone
    Feb 13, 2012 at 11:04
  • @chefnelone What you are talking about is not a "field" but the core functionality behind VBO which won't work without Views and is not something that is possible to add to entities like orders are.
    – googletorp
    Feb 13, 2012 at 11:25
6

If you've got 65,000 orders that you need to wipe, VBO isn't an option. You can try this:

TRUNCATE commerce_customer_profile;
TRUNCATE commerce_customer_profile_revision;
TRUNCATE commerce_funds_transactions;
TRUNCATE commerce_funds_user_funds;
TRUNCATE commerce_line_item;
TRUNCATE commerce_order;
TRUNCATE commerce_order_revision;
TRUNCATE commerce_payment_transaction;
TRUNCATE commerce_payment_transaction_revision;
TRUNCATE commerce_paypal_ipn;

TRUNCATE field_data_commerce_customer_address;
TRUNCATE field_data_commerce_customer_billing;
TRUNCATE field_data_commerce_customer_shipping;
TRUNCATE field_data_commerce_line_items;
TRUNCATE field_data_commerce_order_total;
TRUNCATE field_data_commerce_price;
TRUNCATE field_data_commerce_product;
TRUNCATE field_data_commerce_shipping_service;
TRUNCATE field_data_commerce_total;
TRUNCATE field_data_commerce_unit_price;

TRUNCATE field_data_commerce_coupon_order_reference;
TRUNCATE field_data_commerce_display_path;
TRUNCATE field_data_field_order_deliveryinstructions;
TRUNCATE field_data_field_order_flags;
TRUNCATE field_data_field_order_id;
TRUNCATE field_data_field_order_notes;
TRUNCATE field_data_field_supplier;


TRUNCATE field_revision_commerce_customer_address;
TRUNCATE field_revision_commerce_customer_billing;
TRUNCATE field_revision_commerce_customer_shipping;
TRUNCATE field_revision_commerce_line_items;
TRUNCATE field_revision_commerce_order_total;
TRUNCATE field_revision_commerce_price;
TRUNCATE field_revision_commerce_product;
TRUNCATE field_revision_commerce_shipping_service;
TRUNCATE field_revision_commerce_total;
TRUNCATE field_revision_commerce_unit_price;

TRUNCATE field_revision_commerce_coupon_order_reference;
TRUNCATE field_revision_commerce_display_path;
TRUNCATE field_revision_field_order_deliveryinstructions;
TRUNCATE field_revision_field_order_flags;
TRUNCATE field_revision_field_order_id;
TRUNCATE field_revision_field_order_notes;
TRUNCATE field_revision_field_supplier;
1
  • 2
    Manually truncating tables can cause issues in drupal if the order entities are referenced anywhere else. I'd use this on a development site but never on production. vijaycs85's answer would probably address the performance concern.
    – Erin
    Aug 4, 2015 at 16:50
2

Commerce Order Cleanup is another attempt on this front:

Allows to cleanup the orders by various order properties like last changed, status.

0

Not the answer you're looking for? Browse other questions tagged or ask your own question.