Delete all orders of a customer

Use this procedure to delete all of the orders of a specific customer.
Perform the following:

  1. Get the orders manager.
    Get an instance of the OrdersManager object.
  2. Get the customer.
    Call the GetCustomer method of the orders manager and pass the customer's unique identifier.
  3. Get the customer's orders.
    Call GetOrders method of the orders manager and filter the resulting querable collection by the customer Id.
  4. Delete the orders of the customer.
    Call DeleteOrder method of the orders manager.
  5. Get the addresses of the customer.
    Call GetCustomerAddresses method of the orders manager and filter the resulting collection by the customer Id.
  6. Delete the addresses of the customer
    Call DeleteCustomerAddress method of the orders manager.
  7. Get the customer statistics
    Call GetCustomerStatistics method of the orders manager.
  8. Delete the customer statistics
    Call DeleteCustomerStatistics method of the orders manager.
  9. Get the customer money.
    Call GetCustomerMoneys method of the orders manager.
  10. Delete the customer money
    Call DeleteCustomerMoney method of the orders manager.
  11. 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

Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.

Web Security for Sitefinity Administrators

The free standalone Web Security lesson teaches administrators how to protect your websites and Sitefinity instance from external threats. Learn to configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.

Foundations of Sitefinity ASP.NET Core Development

The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.

Was this article helpful?