Documentation

Ucommerce includes full API reference documentation and lots of helpful articles to help you build your e-commerce site as effortlessly as possible.

Topics Payment Providers
v7.18

Dynamic Order Properties: Adding Custom Information to Baskets, Orders, and Order Lines

When working with an e-commerce transaction system in an online store typically the information stored on the orders and order lines will come from the products themselves in the catalog system.

However, in some cases you might want to add custom information such as a personalized message, an indication whether gift wrapping is required, serial numbers, measurements, or something else entirely.

Enter Dynamic Order Properties

For this specific scenario Ucommerce supports dynamic order properties, which is a way to add information to basket, orders, and individual order lines.

You can add as many as you want and you don’t have to stick with the same number of properties or even the same names across orders.

Using Dynamic Order Properties in Razor and .NET

Order properties:

    ITransactionLibrary transactionLibrary = ObjectFactory.Instance.Resolve<Ucommerce.Api.ITransactionLibrary>();
    
    transactionLibrary.SetOrderProperty("hello", "world");
    
    

OrderLine properties:

    
    Ucommerce.EntitiesV2.PurchaseOrder basket = transactionLibrary.GetBasket(false);
    
    basket.OrderLines.First()["hello"] = "world";
    
    basket.Save();
    
    

Reading properties:

    string myValue = basket["key"];
    string hello = basket.OrderLines.First()["world"];
    
    

Admin

Dynamic order properties will be displayed in Ucommerce Admin as part of the order overview.

Image

Summary

Dynamic order properties is a great way to add custom information to orders during checkout or indeed later in the order process if required. It can be used to capture customer choice for later use such as custom messages, newsletter sign up flags, and more.

Because they are automatically picked up by the order management interface in the backend they are useful for information store managers need to know during the order management process.