November Happy Hour will be moved to Thursday December 5th.

K Khan
Feb 1, 2016
  2759
(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
Adding Geolocation Personalisation to Optimizely CMS with Cloudflare

Enhance your Optimizely CMS personalisation by integrating Cloudflare's geolocation headers. Learn how my Cloudflare Geo-location Criteria package...

Andy Blyth | Nov 26, 2024 | Syndicated blog

Optimizely SaaS CMS + Coveo Search Page

Short on time but need a listing feature with filters, pagination, and sorting? Create a fully functional Coveo-powered search page driven by data...

Damian Smutek | Nov 21, 2024 | Syndicated blog

Optimizely SaaS CMS DAM Picker (Interim)

Simplify your Optimizely SaaS CMS workflow with the Interim DAM Picker Chrome extension. Seamlessly integrate your DAM system, streamlining asset...

Andy Blyth | Nov 21, 2024 | Syndicated blog

Optimizely CMS Roadmap

Explore Optimizely CMS's latest roadmap, packed with developer-focused updates. From SaaS speed to Visual Builder enhancements, developer tooling...

Andy Blyth | Nov 21, 2024 | Syndicated blog