Manage Shopify products, variants, and collections using the GraphQL Admin API. Use when creating, updating, or querying products, managing inventory, or building product catalog integrations. Trigger with phrases like "shopify products", "create shopify product", "shopify variants", "shopify collections", "shopify inventory".
Primary workflow for Shopify: manage products, variants, collections, and inventory using the GraphQL Admin API. Covers CRUD operations with real API mutations and response shapes.
shopify-install-auth setupread_products, write_products, read_inventory, write_inventoryUse productCreate with ProductCreateInput (as of 2024-10, this replaced the old unified ProductInput). Always check userErrors -- Shopify returns 200 even on validation failures.
See Product Create Mutation for the complete mutation, variables, and error handling.
Use productUpdate with ProductUpdateInput (separate from create as of 2024-10). Supports metafield updates inline.
See Product Update Mutation for the complete mutation and variables.
Search products using Shopify's query syntax (status:active, product_type:Apparel AND vendor:'My Brand', tag:sale, etc.) with cursor-based pagination.
See Search Products Query for the complete query with pagination and query syntax examples.
Create variants in bulk with productVariantsBulkCreate, including pricing, SKU, barcode, option values, and inventory quantities per location.
See Bulk Create Variants for the complete mutation and variables.
Create smart (automated) collections with rule-based product matching using tag, product type, and other column filters.
See Smart Collection Create for the complete mutation and variables.
| Error | Cause | Solution |
|---|---|---|
userErrors: [{code: "TAKEN", field: ["handle"]}] | Duplicate product handle | Use a unique handle or let Shopify auto-generate |
userErrors: [{code: "BLANK", field: ["title"]}] | Empty required field | Provide non-empty title |
userErrors: [{code: "INVALID"}] | Invalid metafield type | Check type matches Shopify's metafield types |
Access denied on productCreate | Missing write_products scope | Request scope in app config |
Product not found | Wrong GID format | Must be gid://shopify/Product/1234567890 (numeric ID) |
// productSet creates OR updates — idempotent by handle
const PRODUCT_SET = `
mutation productSet($input: ProductSetInput!) {
productSet(input: $input) {
product { id title }
userErrors { field message code }
}
}
`;
await client.request(PRODUCT_SET, {
variables: {
input: {
title: "Organic Coffee Beans",
handle: "organic-coffee-beans", // unique identifier
productType: "Coffee",
vendor: "Bean Co",
},
},
});