Loading...
Area: Optimizely Commerce
ARCHIVED This content is retired and no longer maintained. See the latest version here.

Recommended reading 

EPiServer Commerce provides two order events for integration purposes so actions can be taken during these events. These events are synchronous, Therefore it is important for the actions to be quick, or be done in an asynchronous manner, so the event can return while the action does its work.

Example of how to use events

[ModuleDependency(typeof(EPiServer.Commerce.Initialization.InitializationModule))]
public class OrderEventInitialization : IConfigurableModule
{
    public void Initialize(InitializationEngine context)
    {
        OrderContext.Current.OrderGroupUpdated += Current_OrderGroupUpdated;
        OrderContext.Current.OrderGroupDeleted += Current_OrderGroupUpdated;
    }

    private void Current_OrderGroupUpdated(object sender, OrderGroupEventArgs e)
    {
        Task.Run(()=> DoSomething(sender as OrderGroup, e));
    }

    private void DoSomething(OrderGroup order, OrderGroupEventArgs e)
    {
         
    }
}
Do you find this information helpful? Please log in to provide feedback.

Last updated: May 25, 2015

Recommended reading