Logo
NeoArc Studio
Mutation

updateProduct

Updates an existing product. Only provided fields are updated; omitted fields retain their current values.

Tags: products, catalog

Signature

mutation { updateProduct(id: ID!, input: UpdateProductInput!): UpdateProductPayload! }

Arguments

Name Type Required Description
id ID! Yes The unique identifier of the product to update
input UpdateProductInput! Yes Product update input with fields to modify

Return Type

UpdateProductPayload!

Complexity: 3

Examples

Query

mutation UpdateProduct($id: ID!, $input: UpdateProductInput!) {
  updateProduct(id: $id, input: $input) {
    product {
      id
      name
      price
      stockQuantity
      updatedAt
    }
    errors {
      field
      message
    }
  }
}

Variables

{
  "id": "prod_abc123",
  "input": {
    "price": "129.99",
    "stockQuantity": 300
  }
}

Response

{
  "data": {
    "updateProduct": {
      "product": {
        "id": "prod_abc123",
        "name": "Wireless Bluetooth Headphones",
        "price": "129.99",
        "stockQuantity": 300,
        "updatedAt": "2024-06-21T15:30:00Z"
      },
      "errors": null
    }
  }
}