Skip to main content

bulkCreateProducts

Requires permission products:product:create.

Creates products from a list of rows, each with a product name, SKU and optional category, brand, prices, cost, stock and unit. Missing categories and brands are created by name. Rows are processed one by one; the result lists what was created and the error for each row that failed. Requires permission to create products.

Errors: a failed call returns a GraphQL errors entry, not a field on the result, and data may be null or partial. Read the entry's extensions.code and message; every shape and code is in the Error reference.

Example:

mutation BulkCreateProducts($input: BulkCreateProductsInput!) {
bulkCreateProducts(input: $input) {
createdCount
failedCount
success
created {
productName
productId
rowIndex
sku
variantId
}
}
}

Variables:

{
"input": {
"rows": [
{
"productName": "string",
"sku": "string"
}
]
}
}

Response:

{
"data": {
"bulkCreateProducts": {
"createdCount": 0,
"failedCount": 0,
"success": true,
"created": [
{
"productName": "string",
"productId": "id",
"rowIndex": 0,
"sku": "string",
"variantId": "id"
}
]
}
}
}
bulkCreateProducts(
input: BulkCreateProductsInput!
): BulkCreateProductsResult!

Arguments​

bulkCreateProducts.input ● BulkCreateProductsInput! non-null input​

The rows to create.

Type​

BulkCreateProductsResult object​

The outcome of a bulk product create.