Model attribute variations

Learn how to create an advanced data model for a product with multi-unit representations.

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

    • Configure the product data model for a footwear company that handles an inventory of shoes with sizes based on several different international and metric measurement units.
  • To wrap up this module, let’s look at a slightly different product data modeling scenario. In this business use case, we will manage the complexities of handling multiple shoe size units within a Composable Commerce architecture.

    We will walk through this scenario by focusing on a fictional Australian company called Shoes for Feet.

    Problem Statement

    Shoes for Feet manages an inventory based on Australian shoe sizes (which is referred to as the 'base size') within their Enterprise Resource Planning system. However, they want to offer customers the flexibility to select sizes by using various international and metric measurement units such as US, UK, EU, Inch, and Centimeter.

    It would be an ineffective approach to map each unit of measurement to a unique Product Variant. This method would result in a substantial increase in the number of variants per product (from 17 to 85 in this scenario), negatively impacting performance, data management, and overall system maintainability.

    It’s important to understand the relationship between sizes and Stock Keeping Units (SKUs) in this scenario. While customers can choose shoe sizes based on different units, the physical SKU representing the actual product remains constant. For instance, an Australian size 7, a European size 39/40, and a US size 9 all correspond to the same physical shoe.

    Creating separate variants for each unit of measurement is unnecessary and inefficient. Variants should primarily represent distinct sellable products, not different unit representations of the same product.

    Objective

    The goal in this scenario is to implement a solution that empowers customers to select shoe sizes in their preferred unit of measurement while simultaneously minimizing the number of Product Variants, ensuring accurate inventory tracking, and simplifying integration with existing systems.

    Proposed solutions

    Instead of generating redundant variants, we propose the following approaches:

    Frontend experience and Cart handling

    After implementing one of the data storage solutions explained earlier, consider these key user experience aspects:

    • Product display: create a user-friendly interface, enabling customers to view and select sizes in their preferred units. Provide clear controls (for example, a dropdown menu) to switch between different units and display corresponding size values dynamically.

    • Cart and Order management: introduce a Custom Field on the Cart Line Item (for example, selectedSize) to store a customer's selected size and unit of measurement (for example, eu:40). This preserves the selected size information throughout the checkout process and in order confirmations. Use LineItemDraft and CustomFieldsDraft to populate this Custom Field during the add-to-cart process.

    Order integration

    A significant advantage of using Product Attributes or a Custom Object is the seamless integration with existing order processes and Enterprise Resource Planning systems. By maintaining the original SKU and variant structure, order synchronization remains simple. No complex mapping logic is required within the integration middleware.

    Even if external systems require variant-level size attributes, these solutions provide the necessary flexibility. Both the base Australian size (size_au) and the customer's selected size (selectedSize Custom Field) can be easily accessed from the order record, simplifying integration and preventing data discrepancies.

    Test your knowledge