Skip to main content
Deletes product attributes after validating none of them is still linked to a product or category. Mirror ProductOptions of axis attributes are deleted alongside. Triggered by DELETE /admin/product-attributes/:id; also run internally when detaching product-scoped attributes. Emits product-attribute.deleted.

Usage

import { deleteProductAttributesWorkflow } from "@mercurjs/core/workflows"

await deleteProductAttributesWorkflow(container).run({
  input: { ids: ["pattr_123"] },
})

Input

ids
string[]
required
Ids of the attributes to delete; the workflow throws if an attribute is still linked.
additional_data
object
Custom data passed through to the hooks.

Result

result
void
No return value.

Hooks

  • validate — runs before deletion with { input }.
  • productAttributesDeleted — runs after deletion with { ids, additional_data }.