[SOLVED] Register pipeline tasks with Umbraco Commerce
b
I have this example based on demo store and latest version of Umbraco Commerce. It hit the
IUmbracoBuilder
extension, but strange enhough it doesn't seem to hit the event handlers or pipeline task, when updating order lines in cart. Anything obvious I am missing?
Copy code
public static IUmbracoBuilder AddMyStore(this IUmbracoBuilder umbracoBuilder)
{
    umbracoBuilder.AddUmbracoCommerce(v =>
    {
        // Enable SQLite support
        //v.AddSQLite();

        // Replace the umbraco product name extractor with one that supports child variants
        //v.Services.AddUnique<IUmbracoProductNameExtractor, CompositeProductNameExtractor>();

        // Register event handlers
        v.WithNotificationEvent<OrderProductAddingNotification>()
            .RegisterHandler<OrderProductAddingHandler>();

        v.WithNotificationEvent<OrderLineChangingNotification>()
            .RegisterHandler<OrderLineChangingHandler>();

        v.WithNotificationEvent<OrderLineRemovingNotification>()
            .RegisterHandler<OrderLineRemovingHandler>();

        v.WithNotificationEvent<OrderPaymentCountryRegionChangingNotification>()
            .RegisterHandler<OrderPaymentCountryRegionChangingHandler>();

        v.WithNotificationEvent<OrderShippingCountryRegionChangingNotification>()
            .RegisterHandler<OrderShippingCountryRegionChangingHandler>();

        v.WithNotificationEvent<OrderShippingMethodChangingNotification>()
            .RegisterHandler<OrderShippingMethodChangingHandler>();

        v.WithCalculateOrderPipeline()
            .Add<ShoppingBagOrderCalculationPipelineTask>();
            //.InsertAfter<CalculateOrderSubtotalPriceWithoutAdjustmentsTask, ShoppingBagOrderCalculationPipelineTask>();
    });

    return umbracoBuilder;
}
`
It turns out it is important that the composer runs before
UmbracoCommerceComposer
otherwise it won't work 🤦‍♂️🙈 https://github.com/umbraco/Umbraco.Commerce.Issues/issues/475