Skip to Content
StoreOSv0.27.1
Core GraphQL APIReferenceMutations

Inventory__apply Variant Template To Products

Copies the template's option groups onto the given products. A product option group with the same name is replaced; other groups are kept. Combinations that still match keep their price, SKU, and images. Returns the number of products updated. Requires a signed-in staff user. Needs the `inventory__Product` `update` permission. Send the `x-tenant` header (the gateway sets it from your API key).

MUTATIONinventory__applyVariantTemplateToProducts(productIds: [ID!]!, templateId: ID!): Int!

Copies the template's option groups onto the given products. A product option group with the same name is replaced; other groups are kept. Combinations that still match keep their price, SKU, and images. Returns the number of products updated. Requires a signed-in staff user. Needs the inventory__Product update permission. Send the x-tenant header (the gateway sets it from your API key).

Arguments

productIds*[ID!]!
templateId*ID!

Returns

inventory__applyVariantTemplateToProducts*Int!
Example Request
mutation Inventory__applyVariantTemplateToProducts($productIds: [ID!]!, $templateId: ID!) {  inventory__applyVariantTemplateToProducts(    productIds: $productIds    templateId: $templateId  )}
Variables
{  "productIds": [    "1"  ],  "templateId": "1"}
Example Response
{  "data": {    "inventory__applyVariantTemplateToProducts": 10  }}