Mutations
GraphQL mutations create, update, or delete objects in the Shopify GraphQL admin API. A mutation has a name, takes input data, and specifies fields to return in the response.
Create a product and return the product ID
mutation {
productCreate(input: {title: "Red Ball", productType: "Toy", vendor: "Toys"}) {
product {
id
}
}
}
Update a product's type and return the product ID and new type
mutation {
productUpdate(input: {id: "gid://shopify/Product/13588", productType: "Ball"}) {
product {
id
type
}
}
}
Great resources for learning GraphQL mutations
Last updated
Was this helpful?