I have a PurchaseOrder. It was created from a Cart, then the Cart was deleted.
Is there any way to figure out the CartId that was used to create this PurchaseOrder? Or is it impossible because the original Cart was deleted?
Unfortunately no. You have several way to store the CartId, such as adding a metafield to the PurchaseOrder, or add a note when the order is created. However if you did not save that information and the cart was deleted then it's gone.
I could use a metafield... but, what about PurchaseOrder.ParentOrderGroupId ? I'm not using that property for anything else... would that be a recommended place to put CartId, or is a metafield better?
PurchaseOrder.ParentOrderGroupId is for case like when you have a payment plan and you create orders from it, then each order will point to that payment plan, or when you have exchange order. It's not strictly probihited to use it to point to the CartId, but as it's a "system" field, so it's better that you use a metafield instead, to avoid possible conflicts.