createProductAttributesWorkflow that creates one or more
ProductAttribute records along with their values. Run it from any place that
has access to the Medusa container.
Run the workflow
src/api/custom/attributes/route.ts
ProductAttributeValue records, and,
for a multi_select axis, the mirror ProductOption. It also emits the
product-attribute.created event.
Leaving
product_id unset creates a global attribute reusable across the
catalog. Passing a product_id creates an inline attribute scoped to a
single product. See Global vs inline.Associate categories
Passcategory_ids on an attribute to associate it with product categories
through the category link in the same call:
Attach custom data
The workflow accepts anadditional_data payload passed to its
productAttributesCreated hook, letting you persist marketplace-specific data
alongside the attribute without forking the workflow.