AI OnAI Off
Could you do
_orderRepository.Load<IPurchaseOrder>(orderReference)
after you've deleted your order? Right now you're loading the customer's purchase orders, so if the customer had previous orders, you'll see them and not the one you deleted.
I have a thiry party payment gateway. When payment fails, i delete order reference from orderrepository. But purchnase order is still there in orderrepository. How to remove purchaseorder from orderrepository? My code is as shown below. purchnase order is showing line items.