Data model extensibility

Composable Commerce allows you to add Custom Fields and Custom Objects to a data resource so that you can represent your custom data model and requirements.

  • After completing this page, you should be able to:

    • Explain what data model extensibility is.
    • Differentiate between the different types of data model extensibility options that Composable Commerce offers.
  • Custom Fields

    Data models represent the underlying structure of your data. Composable Commerce has a flexible data model that covers a wide range of ecommerce use cases out of the box. Additionally, you can use Custom Fields in cases where the standard data model is not sufficient to represent your specific requirements.

    Let's look at the following example. Imagine you have a user who wants to sign up for a new customer account on your storefront. Your business requires the nationality of the customer to be stored in the customer records. However, the Customer resource in Composable Commerce does not offer a field for this purpose. This is where data model extensibility can help. Using Custom Fields, you can create a new field, for example, nationalId, to capture the desired information. After you assign the new Custom Field to the Customer resource, you will be able to capture and store the nationality information for each of your customers using Composable Commerce.

    Setting up a new Custom Field is an API-only operation. This means that you won't be able to use the Merchant Center interface for it. Custom Fields are created using the Types API. The Types endpoint allows you to define a new field or a list of fields to enrich any of the customizable resources.

    Every customizable resource can be extended with only one Type at a time. However, a Type can contain any number of different fields. For example, the Customer resource can be extended with only one Type, but this Type could consist of multiple different fields that capture the customer's shoe size, nationality, email preferences, and so on.

    Note that you cannot assign Custom Fields to Products. Instead, you can extend a Product's data using Product Types. Product Types are used to define custom Attributes that your Products share. Follow along with the Product data modeling module to learn more about Product Types.

    Custom Objects

    Custom Fields and Product Attributes are a great solution for enriching the data for existing resource types. However, what if you want to store data that is not coupled with any of the customizable resources? This could be information that you access infrequently or something you want to represent as an entirely new resource. In this case, Custom Objects can provide an alternative.

    Imagine you maintain a list of vendors and suppliers for a specific product. Storing this information using custom Attributes on a Product would mean that the whole list is retrieved each time you access a product's data. You can instead use Custom Objects which will allow you to store data (in this case your list of vendors and suppliers) and only fetch them when necessary.

    Custom Objects can store any data that does not fit the standard data model offered by Composable Commerce. This frees your application from third-party persistence solutions and means that your data can stay in one place.

    Similarly to Custom Fields, creating Custom Objects is an API-only operation. As such, they cannot be set up and used in the Merchant Center.

    Test your knowledge