Type Alias: Metafields
Metafields =
Record<string,MetaFieldValue>
Custom key-value parameters for options.
Metafields provide a flexible extension mechanism for attaching additional data to options beyond the standard fields defined in the configurator. They enable dynamic customization without modifying the core data model, making them ideal for product-specific requirements, integration with external systems, or evolving business logic.
Each metafield is identified by a unique key and can store values of any type defined in MetaFieldValue, from simple primitives to complex structured data. This flexibility allows metafields to adapt to various use cases while maintaining type safety and consistency.
Common use cases for metafields include:
- Storing vendor-specific product codes or SKUs
- Tracking manufacturing specifications or constraints
- Maintaining compatibility matrices with other options
- Recording custom pricing rules or discounts
- Preserving user preferences or configuration history
- Linking to external resources or documentation
Example
const optionMetafields: Metafields = {
vendorCode: "ABC-123",
weight: 2.5,
requiresSpecialHandling: true,
specifications: [
{
material: "aluminum",
thickness: 3,
coating: "anodized"
}
],
technicalDrawing: {
fileId: "file_xyz",
filePath: "/drawings/option_123.pdf"
}
};