Skip to main content
Handles the update portion of the attribute batch engine (createAndLinkProductAttributesToProductWorkflow). For shared axis attributes it adjusts the per-product value subset of the mirror option and keeps the value-link pivot in sync; for exclusive (product-scoped) axis attributes it creates or deletes values on the exclusive option; for text/unit it swaps the linked value’s name (or creates one); for toggle it re-links the matching true/false value. A title on a product-scoped attribute renames it via updateProductAttributesWorkflow.

Usage

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

await updateProductAttributesOnProductWorkflow(container).run({
  input: {
    product_id: "prod_123",
    update: [
      { id: "pattr_size", add: ["pattrval_xl"], remove: ["pattrval_s"] },
      { id: "pattr_material", value: "Linen" },
    ],
  },
})

Input

product_id
string
required
The product whose attribute selections are updated.
update
ProductAttributeBatchUpdate[]
required
Per-attribute updates.
additional_data
object
Custom data passed through.

Result

result
void
No return value.