multi_select attribute with is_variant_axis set. Creating
one mirrors a native Medusa ProductOption, so the values a product selects along
the axis become the dimensions Medusa uses to generate variants.
Create the axis attribute
src/api/custom/attributes/route.ts
ProductAttribute, a mirror ProductOption, and a
ProductAttributeValue for each option value. It wires product_option_id and
product_option_value_id behind the scenes.
Attach it to a product
Attach the axis to a product and pass the subset of values that product offers. Medusa generates a variant for each selected value.Only
multi_select attributes can be variant axes. The value_ids you pass
are the per-product subset of the axis’s values. Only those become variants.Inline axes
To create a product-scoped axis in the same step it’s attached, pass the inline form instead of an existing id. This creates an exclusiveProductOption, a
scoped attribute (product_id set), and the value mirror in one call: