Skip to main content
Splits the given values by id: entries without an id are created on the attribute, entries with an id are updated in place. Unlike the create/update value workflows it does not touch the mirror ProductOption (renaming a value in place does not re-sync the mirrored option) and it emits no events.

Usage

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

const { result } = await upsertProductAttributeValuesWorkflow(container).run({
  input: {
    attribute_id: "pattr_color",
    values: [
      { name: "Teal" },
      { id: "pattrval_123", name: "Navy Blue" },
    ],
  },
})

Input

attribute_id
string
required
The attribute the values belong to.
values
UpsertProductAttributeValueDTO[]
required
Values to create (no id) or update (with id).
additional_data
object
Custom data passed through.

Result

result
ProductAttributeValueDTO[]
The created values followed by the updated values.