Posts Tagged ‘magento delete orders’

Hello Everyone,

You can delete order of particular customer using below code .. You need to run below code in adminpanel.

<?php $order = Mage::getModel(‘sales/order’)->getCollection()
->addAttributeToFilter(‘customer_id’,’14’);//”14″ is a id of customer
print_r($order->count()); // It display no. of order place by customer whose id is ’14’
foreach ($order as $ord) {
echo $ord->getIncrementId() . ‘<br>’; //It display increment id of order
$ord->delete(); //This statement delete order
} ?>

I hope the above code is help you to delete sales order in magento

Thanks,
Bijal Bhavsar 🙂