Hi Patrik, I will suggest stored procedures with the BEGIN TRAN clause once all delete queries execute then COMMIT TRAN else ROLLBACK TRAN for safer hand.
And we also delete PII data from the products so refer below link for deleting GDPR PII data.
I'm not an GDPR expert, but as far as I understand, orders are financial contracts that override the rules. So you don't have to delete orders to be GDPR-compatible.
In case you really want to delete an order, I suggest to go with API instead
var order = OrderContext.Current.GetPurchaseOrder(trackingNumber);
What is the best way to delete all traces of a purchase order from the commerce database, based on the tracking number? I know how to resolve the object id from OrderGroup_PurchaseOrder...
Should I delete directly from the tables, or is it preferable to use the stored procedures instead?
I just want to make sure that I delete *all* data related to the purchase order (except data in the catalog, etc :) ).
If you proceed to delete PO with Quan Mai's suggestion so that should be the best approach.