After I have converted my cart to a purchase order, I want to delete the cart. How can I do that programmatically?
public void DeleteCart(ICart cart){ // what to do here?}
It's in Commerce 11.
You can do it by using OrderRepository, like:
public void DeleteCart(ICart cart) { // what to do here? OrderRepository.Service.Delete(cart.OrderLink); }
As addition to Giang's answer, you should use IOrderRepository, and you should inject it to your constructor as a best practice.
After that, just
_orderRepository.Delete(cart.OrderLink);
After I have converted my cart to a purchase order, I want to delete the cart. How can I do that programmatically?
It's in Commerce 11.