Skip to main content
Updates attribute values by selector. When the touched values belong to a single variant-axis multi_select attribute with a mirror ProductOption, the option’s value list is rewritten from the attribute’s current value names. Triggered by POST /admin/product-attributes/:id/values/:value_id. Emits product-attribute-value.updated.

Usage

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

const { result } = await updateProductAttributeValuesWorkflow(container).run({
  input: {
    selector: { id: "pattrval_123" },
    update: { name: "Dark Green" },
  },
})

Input

selector
object
required
Filter for the values to update, e.g. { id: "pattrval_123" }.
update
UpdateProductAttributeValueDTO
required
Fields to set on every matched value.
additional_data
object
Custom data passed through to the hooks.

Result

result
ProductAttributeValueDTO[]
The updated values.

Hooks

  • validate — runs before the update with { input }.
  • productAttributeValuesUpdated — runs after the update with { values, additional_data }.