Calling all developers! We invite you to provide your input on Feature Experimentation by completing this brief survey.

 

K Khan
Feb 1, 2016
  2784
(3 votes)

Cancel Order Notes

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.

  • Update the Order Status to OrderStatus.Cancelled.
  • Run the work flow "RecalculatePurchaseOrderWorkflow".

There are following activities involved in "RecalculatePurchaseOrderWorkflow".

ValidateLineItemsActivity
GetFulfillmentWarehouseActivity
CheckInstoreInventoryActivity
CheckInventoryActivity
AdjustInventoryActivity
ProcessShipmentsActivity
RemoveDiscountsActivity
CalculateTotalsActivity
CalculateDiscountsActivity
CalculateTotalsActivity
CalculateTaxActivity
CalculateTotalsActivity
CalculatePurchaseOrderStatusActivity


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.

Feb 01, 2016

Comments

Please login to comment.
Latest blogs
Find and delete non used media and blocks

On my new quest to play around with Blazor and MudBlazor I'm going back memory lane and porting some previously plugins. So this time up is my plug...

Per Nergård (MVP) | Jan 21, 2025

Optimizely Content Graph on mobile application

CG everywhere! I pull schema from our default index https://cg.optimizely.com/app/graphiql?auth=eBrGunULiC5TziTCtiOLEmov2LijBf30obh0KmhcBlyTktGZ in...

Cuong Nguyen Dinh | Jan 20, 2025

Image Analyzer with AI Assistant for Optimizely

The Smart Image Analyzer is a new feature in the Epicweb AI Assistant for Optimizely CMS that automates the management of image metadata, such as...

Luc Gosso (MVP) | Jan 16, 2025 | Syndicated blog

How to: create Decimal metafield with custom precision

If you are using catalog system, the way of creating metafields are easy – in fact, you can forget about “metafields”, all you should be using is t...

Quan Mai | Jan 16, 2025 | Syndicated blog