Delete all orders of a customer
Use this procedure to delete all of the orders of a specific customer.
Perform the following:
- Get the orders manager.
Get an instance of the OrdersManager object.
- Get the customer.
Call the GetCustomer method of the orders manager and pass the customer's unique identifier.
- Get the customer's orders.
Call GetOrders method of the orders manager and filter the resulting querable collection by the customer Id.
- Delete the orders of the customer.
Call DeleteOrder method of the orders manager.
- Get the addresses of the customer.
Call GetCustomerAddresses method of the orders manager and filter the resulting collection by the customer Id.
- Delete the addresses of the customer
Call DeleteCustomerAddress method of the orders manager.
- Get the customer statistics
Call GetCustomerStatistics method of the orders manager.
- Delete the customer statistics
Call DeleteCustomerStatistics method of the orders manager.
- Get the customer money.
Call GetCustomerMoneys method of the orders manager.
- Delete the customer money
Call DeleteCustomerMoney method of the orders manager.
- Save the changes to the manager.
Use the following code sample:
As a result all orders made by a specific customer are deleted.
For more information on deleting a customer see: For developers: Delete customers