Skip to content

Instantly share code, notes, and snippets.

@apurbajnu
Created February 21, 2023 10:09
Show Gist options
  • Select an option

  • Save apurbajnu/44c7e46b53dab6df99364f20f0bae549 to your computer and use it in GitHub Desktop.

Select an option

Save apurbajnu/44c7e46b53dab6df99364f20f0bae549 to your computer and use it in GitHub Desktop.
Shopify Product Import Graphql
mutation {
productCreate(input: {
title: "Demo Product",
descriptionHtml: "This is a demo product description.",
productType: "Demo Product Type",
vendor: "Demo Vendor",
handle: "demo-product",
published: true,
options: [
{ name: "Size", values: ["Small", "Medium", "Large"] },
{ name: "Color", values: ["Red", "Green", "Blue"] }
],
variants: [
{
price: "19.99",
sku: "demo-product-small-red",
barcode: "1234567890",
inventoryQuantities: [
{ locationId: "gid://shopify/Location/1234567890", availableQuantity: 10 }
],
options: [
{ name: "Size", value: "Small" },
{ name: "Color", value: "Red" }
]
},
{
price: "21.99",
sku: "demo-product-medium-green",
barcode: "0987654321",
inventoryQuantities: [
{ locationId: "gid://shopify/Location/1234567890", availableQuantity: 5 }
],
options: [
{ name: "Size", value: "Medium" },
{ name: "Color", value: "Green" }
]
},
{
price: "24.99",
sku: "demo-product-large-blue",
barcode: "2345678901",
inventoryQuantities: [
{ locationId: "gid://shopify/Location/1234567890", availableQuantity: 3 }
],
options: [
{ name: "Size", value: "Large" },
{ name: "Color", value: "Blue" }
]
}
],
images: [
{ src: "https://example.com/demo-product-image-1.jpg" },
{ src: "https://example.com/demo-product-image-2.jpg" }
]
}) {
product {
id
}
userErrors {
field
message
}
}
}
@apurbajnu
Copy link
Author

mutation productUpdate($input: ProductInput!) {
productUpdate(input: $input) {
product {
# Product fields
}
userErrors {
field
message
}
}
}

mutation productCreate($input: ProductInput!) {
productCreate(input: $input) {
product {
# Product fields
}
shop {
# Shop fields
}
userErrors {
field
message
}
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment