|Number of votes:||3|
There are few considerations for allowing customers to cancel their orders if those have not been processed. It is up to the business when they allow the customer to cancel the order after placing an order, depending on the complexity of their fulfilment system and payment strategy. If EPiServer commerce site is tracking the inventories those should be restored and if some payment has been taken that will also require a return.
OrderStatusManager class contains some helpful functions to achieve this.
purchaseOrder = OrderStatusManager.CancelOrder(purchaseOrder); purchaseOrder.AcceptChanges();
OrderStatusManager.CancelOrder does two things.
There are following activities involved in "RecalculatePurchaseOrderWorkflow".
This work flow will adjust the inventory of the site (if tracking) but it does not process payments. To process payments (if required), either we can write your own workflow like as "RecalculatePurchaseOrderWorkflow" or can process the refunds during cancellation.