Query variants
{ product(id: "gid://shopify/Product/123") { variants(first: 100) { nodes { id sku price inventoryQuantity selectedOptions { name value } } } } }
Create variant
mutation { productVariantCreate(input: { productId: "gid://shopify/Product/123", options: ["Small", "Red"], price: "25.00", sku: "TSHIRT-S-RED" }) { productVariant { id } } }
Update inventory
mutation { inventoryAdjustQuantity(input: { inventoryLevelId: "gid://shopify/InventoryLevel/456", availableDelta: -1 }) { inventoryLevel { available } } }
Bulk operations
For 1000+ variants, use Bulk Operations API. Async, better rate limits.
Frequently asked questions
Should I use GraphQL or REST for Shopify variants?
GraphQL. REST is deprecated for new integrations. Same functionality, better efficiency.
Query variant by SKU?
products(query: "sku:TSHIRT-S-RED") then filter variants.
Create variant via GraphQL?
productVariantCreate mutation with options array + price + SKU.
Update variant price?
productVariantUpdate mutation with new price value.
Bulk import 1000+ variants?
Bulk Operations API. Async, better rate limits than one-at-a-time.
GraphQL rate limits?
Cost-based. Each query has cost points. Watch throttleStatus in response.
Best GraphQL client for Shopify?
Apollo (React/Vue). shopify-api-node (Node). Official Shopify GraphQL Admin API library.
Debug GraphQL queries?
Shopify GraphiQL app — interactive query builder in admin. Or Postman/Insomnia.
Related reading
Try it free on Shopify
Print It My Way's permanent Free plan includes live preview, custom options, and Cart Transform pricing.
Install Print It My Way