Order Number Generation
The default order number generator creates random non sequentual order numbers such as:
6736-889308-306
.
Replacing the generator
Implement IOrderNumberGenerator, for example:
public class CustomOrderNumberGenerator : IOrderNumberGenerator
{
public string Generate(Basket basket)
{
var random = new Random();
var timeElement = long.Parse(DateTime.UtcNow.ToString("HHmmssff")) / 25;
return $"{random.Next(0, 9999):D4}-{timeElement}-{random.Next(0, 999):D3}";
}
}
Now register this as a singleton using a composer:
public class CustomOrderNumberComposer : IComposer
{
public void Compose(IUmbracoBuilder builder)
{
builder.Services.AddSingleton<IOrderNumberGenerator, CustomOrderNumberGenerator>();
}
}