Vendr is now Umbraco Commerce

Vendr is now part of Umbraco HQ and is being replaced by Umbraco Commerce. Click here to jump to the Umbraco Commerce documentation.

Vendr Builder

Configuring Vendr, the eCommerce solution for Umbraco

When it comes to configuring and extending Vendr, such as by registering your own event handlers, we achieve this with the IVendrBuilder interface that can be accessed via a delegate function passed in to the AddVendr() extension method called on the IUmbracoBuilder interface when explicitly registering Vendr.

public class Startup
{
    ...
    public void ConfigureServices(IServiceCollection services)
    {
        services.AddUmbraco(_env, _config)
            .AddBackOffice()
            .AddWebsite()
            .AddVendr(vendrBuilder => {
                // Configure Vendr here
            })
            .AddComposers()
            .Build();
    }
    ...
}

Registering Dependencies

The IVendrBuilder interface gives you easy access to the current IServiceCollection and IConfiguration to allow you to register dependencies like you would with the IUmbracoBuilder interface but it's primary use case would be to access Vendr's own collection builders, such as for registering validation or notification events, and any other Vendr specific configuration APIs.

...
.AddVendr(vendrBuilder => {
    
    // Register validation events
    vendrBuilder.WithValidationEvent<ValidateOrderProductAdd>()
            .RegisterHandler<MyOrderProductAddValidationHandler>();

})
...

As per the Dependency Injection docs, whilst you can register your dependencies directly within this configuration delegate, you may prefer to group your dependencies registration code into an extension method.

public static class VendrBuilderExtensions
{
    public static IVendrBuilder AddMyDependencies(this IVendrBuilder builder)
    {
        // Register my dependencies here via the builder parameter
        ...

        // Return the builder to continue the chain
        return builder;
    }
}
...
.AddVendr(vendrBuilder => {
    
    vendrBuilder.AddMyDependencies();

})
...

Edit this page on GitHub

Site + logo design © 2025 Outfield Digital Ltd. Content contributions licensed under MIT.
Vendr® is a Registered Trademark of Outfield Digital Ltd.