Link products to modifier

View as Markdown
## Link products to a modifier Sets the **complete list of products** a modifier applies to. The supplied `productIds` array is the desired final state: every existing link for the modifier is deleted and then recreated from the array. ### Authentication - Merchant API key in **`x-api-key`** (alias `x-account-api-key`). - Requires **`Merchant.product.update`**. ### Body (application/json) - `modifierId` (required) — UUID of the modifier. Must belong to your store, otherwise **400 Bad Request** (`Modifier not found in yours`). - `productIds` (required) — non-empty array of unique product UUIDs. Every id must belong to your store, otherwise **403 Forbidden** (`Some products do not belong to your store`). ### Behavior & side-effects - Runs in a single transaction: `deleteMany({ modifierId })` followed by `createMany` with `skipDuplicates`. - Because it replaces the set, sending a product list that omits a currently linked product **unlinks** it. - Returns `{ message: "Products linked to modifier successfully" }`. --- **Notas:** Handler: productModifiersService.linkProductsForModifier. Replacement semantics, not incremental. Duplicated ids in the payload are de-duplicated before the ownership check (@ArrayUnique also rejects duplicates at validation time).

Authentication

x-api-keystring
API Key authentication via header

Headers

x-application-account-idstringOptional

Scope the request to a specific store / account instead of the one resolved from the API key. Aliases: the x-account-id header, or the application_account_id / account_id query parameter.

Request

This endpoint expects an object.
modifierIdstringRequiredformat: "uuid"
productIdslist of stringsRequired