> ## Content Index
> Fetch the complete content index at: https://blog.tsd.digital/llms.txt
> Use this file to discover other available public pages before exploring further.

# Delete all orders from Ucommerce
- URL: https://blog.tsd.digital/delete-all-orders-from-ucommerce/
- Published: 2021-05-22T09:45:00.000Z
- Updated: 2021-05-22T09:45:00.000Z
- Author: Tim Gaunt
- Tags: Ucommerce, Useful Script, #Import 2025-04-01 05:39

A while ago I blogged about \[how to delete test orders and baskets from Ucommerce\](https://thesitedoctor.co.uk/blog/deleting-test-orders-and-baskets-from-ucommerce/) and \[Delete all products and orders from Ucommerce\](https://thesitedoctor.co.uk/blog/delete-all-products-and-orders-from-ucommerce/) which I frequently use. As I often want to only clear out the orders as well so I thought it worth popping together a quick script to delete only the orders. This works on Ucommerce v9 and should work for older versions too but I've not tested it. BEGIN TRAN DELETE FROM uCommerce\_OrderLineDiscountRelation DELETE FROM uCommerce\_ShipmentDiscountRelation DELETE FROM uCommerce\_Discount UPDATE uCommerce\_OrderLine SET ShipmentId = NULL UPDATE uCommerce\_PurchaseOrder SET BillingAddressId = NULL DELETE FROM uCommerce\_Shipment DELETE FROM uCommerce\_OrderAddress DELETE FROM uCommerce\_OrderProperty DELETE FROM uCommerce\_OrderLine DELETE FROM uCommerce\_PaymentProperty DELETE FROM uCommerce\_Payment DELETE FROM uCommerce\_OrderStatusAudit DELETE FROM uCommerce\_PurchaseOrder DELETE FROM uCommerce\_Address -- NOTE: Only needed if you use our Stripe package -- DELETE FROM uCommerce\_StripeCustomer SELECT \* FROM uCommerce\_PurchaseOrder o ROLLBACK TRAN -- When happy it works, uncomment this line and comment out the ROLLBACK -- COMMIT TRAN