Skip to main content
The Product Attribute module owns 2 data models: ProductAttribute and ProductAttributeValue. Both are defined in packages/core/src/modules/product-attribute/models and resolved through MercurModules.PRODUCT_ATTRIBUTE ("product_attribute"). Like every Medusa data model, each also gets created_at, updated_at, and deleted_at timestamps.

ProductAttribute

A typed attribute in the shared catalog, either global or scoped to one product. Id prefix pattr. Relations and constraints:
  • values: has many ProductAttributeValue, deleted with the attribute
  • IDX_product_attribute_handle_unique: unique handle where deleted_at IS NULL AND handle IS NOT NULL
  • IDX_product_attribute_type: index on type
  • IDX_product_attribute_product_id: index on product_id where it’s not null

ProductAttributeValue

One selectable value of an attribute, or the stored value of a text, unit, or toggle attribute on a product. Id prefix pattrval. Relations and constraints:
  • attribute: belongs to ProductAttribute through attribute_id
  • IDX_product_attribute_value_handle_unique: unique (attribute_id, handle) where deleted_at IS NULL AND handle IS NOT NULL

AttributeType enum

AttributeType is exported from @mercurjs/types:
Neither model stores which products hold a value. That lives in the product_attribute_value_link pivot table, described in Links.