> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mercurjs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# updateProductAttributesWorkflow

> Update attributes matching a selector and sync mirror option titles.

Updates product attributes by selector. When `name` changes, the mirror `ProductOption` title of any affected axis attribute is updated to match. Triggered by `POST /admin/product-attributes/:id`. Emits `product-attribute.updated`.

## Usage

```ts theme={null}
import { updateProductAttributesWorkflow } from "@mercurjs/core/workflows"

const { result } = await updateProductAttributesWorkflow(container).run({
  input: {
    selector: { id: "pattr_123" },
    update: { name: "Colour", is_filterable: true },
  },
})
```

## Input

<ParamField body="selector" type="object" required>Filter for the attributes to update, e.g. `{ id: "pattr_123" }`.</ParamField>

<ParamField body="update" type="UpdateProductAttributeDTO" required>
  Fields to set on every matched attribute.

  <Expandable title="properties">
    <ParamField body="name" type="string">New display name; propagated to mirror option titles.</ParamField>
    <ParamField body="handle" type="string">New handle.</ParamField>
    <ParamField body="description" type="string | null">New description.</ParamField>
    <ParamField body="type" type="AttributeType">One of `single_select`, `multi_select`, `unit`, `toggle`, `text`.</ParamField>
    <ParamField body="is_required" type="boolean">Whether products must carry this attribute.</ParamField>
    <ParamField body="is_filterable" type="boolean">Whether the attribute is a storefront filter.</ParamField>
    <ParamField body="is_variant_axis" type="boolean">Whether the attribute is a variant axis.</ParamField>
    <ParamField body="rank" type="number">Sort rank.</ParamField>
    <ParamField body="is_active" type="boolean">Whether the attribute is active.</ParamField>
    <ParamField body="metadata" type="object | null">Custom key-value data.</ParamField>
  </Expandable>
</ParamField>

<ParamField body="additional_data" type="object">Custom data passed through to the hooks.</ParamField>

## Result

<ResponseField name="result" type="ProductAttributeDTO[]">The updated attributes.</ResponseField>

## Hooks

* `validate` — runs before the update with `{ input }`.
* `productAttributesUpdated` — runs after the update with `{ attributes, additional_data }`.
