Created
June 3, 2014 14:11
-
-
Save recidive/bfb8c897e761d7d7f7b9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function custom_delete_all_orders() { | |
// Delete orders. | |
$order_ids = db_query('SELECT order_id FROM {commerce_order}')->fetchCol(); | |
commerce_order_delete_multiple($order_ids); | |
unset($order_ids); | |
// Delete line items. | |
$line_item_ids = db_query('SELECT line_item_id FROM {commerce_line_item}')->fetchCol(); | |
commerce_line_item_delete_multiple($line_item_ids); | |
unset($line_item_ids); | |
// Delete customer profiles. | |
$profile_ids = db_query('SELECT profile_id FROM {commerce_customer_profile}')->fetchCol(); | |
commerce_customer_profile_delete_multiple($profile_ids); | |
unset($profile_ids); | |
// Delete payment transactions. | |
$transaction_ids = db_query('SELECT transaction_id FROM {commerce_payment_transaction}')->fetchCol(); | |
commerce_payment_transaction_delete_multiple($transaction_ids); | |
unset($transaction_ids); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment