CreateProduct
Create a product
Note: This mutation can be used only for companies that can create products.
Parameters
input - ProductInput |
---|
Data of the product |
Example
mutation CreateProduct($input: ProductInput!) {
CreateProduct(input: $input) {
id
label
description
active
suppliers {
paginatorInfo {
total
}
data {
id
label
}
}
variants {
paginatorInfo {
total
count
currentPage
perPage
}
data {
id
sku
type
label
barcode
initial_cost
purchase_price_amount
purchase_price_currency
weight_amount
weight_unit
track_inventory
on_hand
available
incoming
reserved
active
product {
id
suppliers {
data {
id
label
}
}
}
attribute1 {
id
label
}
attribute2 {
id
label
}
attribute3 {
id
label
}
suppliers {
id
supplier_sku
supplier {
id
label
}
}
components {
component {
label
product {
id
}
}
}
}
}
option1 {
id
label
}
option2 {
id
label
}
option3 {
id
label
}
}
}
{
"input": {
"label": "Bicycle for kids",
"active": true,
"description": "<p>Bicycle for kids</p>",
"suppliers": {
"data": [
{
"id": 100005
},
{
"id": 100003
}
]
},
"variants": {
"data": [
{
"sku": "B127621-1",
"type": "normal",
"barcode": "122657816782",
"weight_amount": null,
"weight_unit": "kg",
"track_inventory": true,
"initial_cost": null,
"purchase_price_amount": null,
"purchase_price_currency": "EUR",
"components": [],
"initial_location": {
"id": 100000
},
"label": "Red - S",
"attribute1": {
"id": 100000
},
"attribute2": {
"id": 100003
},
"suppliers": [
{
"id": 100003
},
{
"id": 100005
}
]
},
{
"sku": "B127621-2",
"type": "normal",
"barcode": "122657816782",
"weight_amount": null,
"weight_unit": "kg",
"track_inventory": true,
"initial_cost": null,
"purchase_price_amount": null,
"purchase_price_currency": "EUR",
"components": [],
"initial_location": {
"id": 100000
},
"label": "Blue - S",
"attribute1": {
"id": 100002
},
"attribute2": {
"id": 100003
},
"suppliers": [
{
"id": 100003
},
{
"id": 100005
}
]
},
{
"sku": "B127621-3",
"type": "normal",
"barcode": "122657816782",
"weight_amount": null,
"weight_unit": "kg",
"track_inventory": true,
"initial_cost": null,
"purchase_price_amount": null,
"purchase_price_currency": "EUR",
"components": [],
"initial_location": {
"id": 100000
},
"label": "Red - M",
"attribute1": {
"id": 100000
},
"attribute2": {
"id": 100005
},
"suppliers": [
{
"id": 100003
},
{
"id": 100005
}
]
},
{
"sku": "B127621-4",
"type": "normal",
"barcode": "122657816782",
"weight_amount": null,
"weight_unit": "kg",
"track_inventory": true,
"initial_cost": null,
"purchase_price_amount": null,
"purchase_price_currency": "EUR",
"components": [],
"initial_location": {
"id": 100000
},
"label": "Blue - M",
"attribute1": {
"id": 100002
},
"attribute2": {
"id": 100005
},
"suppliers": [
{
"id": 100003
},
{
"id": 100005
}
]
}
]
},
"option1": {
"id": 100000,
"label": "Color"
},
"option2": {
"id": 100001,
"label": "Size"
}
}
}
Returned data
{
"data": {
"CreateProduct": {
"id": 100315,
"label": "Bicycle for kids",
"description": "<p>Bicycle for kids</p>",
"active": true,
"suppliers": {
"paginatorInfo": {
"total": 2
},
"data": [
{
"id": 100005,
"label": "deleniti"
},
{
"id": 100003,
"label": "dolor"
}
]
},
"variants": {
"paginatorInfo": {
"total": 4,
"count": 4,
"currentPage": 1,
"perPage": 50
},
"data": [
{
"id": 100363,
"sku": "B127621-1",
"type": "normal",
"label": "Bicycle for kids - Red - S",
"barcode": "122657816782",
"initial_cost": null,
"purchase_price_amount": null,
"purchase_price_currency": null,
"weight_amount": null,
"weight_unit": "kg",
"track_inventory": true,
"on_hand": null,
"available": null,
"incoming": null,
"reserved": null,
"active": true,
"product": {
"id": 100315,
"suppliers": {
"data": [
{
"id": 100005,
"label": "deleniti"
},
{
"id": 100003,
"label": "dolor"
}
]
}
},
"attribute1": {
"id": 100000,
"label": "Red"
},
"attribute2": {
"id": 100003,
"label": "S"
},
"attribute3": null,
"suppliers": [
{
"id": 100003,
"supplier_sku": "DO8877",
"supplier": null
},
{
"id": 100005,
"supplier_sku": "DE1288912",
"supplier": null
}
],
"components": []
},
{
"id": 100364,
"sku": "B127621-2",
"type": "normal",
"label": "Bicycle for kids - Blue - S",
"barcode": "122657816782",
"initial_cost": null,
"purchase_price_amount": null,
"purchase_price_currency": null,
"weight_amount": null,
"weight_unit": "kg",
"track_inventory": true,
"on_hand": null,
"available": null,
"incoming": null,
"reserved": null,
"active": true,
"product": {
"id": 100315,
"suppliers": {
"data": [
{
"id": 100005,
"label": "deleniti"
},
{
"id": 100003,
"label": "dolor"
}
]
}
},
"attribute1": {
"id": 100002,
"label": "Blue"
},
"attribute2": {
"id": 100003,
"label": "S"
},
"attribute3": null,
"suppliers": [
{
"id": 100003,
"supplier_sku": "DO8877",
"supplier": null
},
{
"id": 100005,
"supplier_sku": "DE1288912",
"supplier": null
}
],
"components": []
},
{
"id": 100365,
"sku": "B127621-3",
"type": "normal",
"label": "Bicycle for kids - Red - M",
"barcode": "122657816782",
"initial_cost": null,
"purchase_price_amount": null,
"purchase_price_currency": null,
"weight_amount": null,
"weight_unit": "kg",
"track_inventory": true,
"on_hand": null,
"available": null,
"incoming": null,
"reserved": null,
"active": true,
"product": {
"id": 100315,
"suppliers": {
"data": [
{
"id": 100005,
"label": "deleniti"
},
{
"id": 100003,
"label": "dolor"
}
]
}
},
"attribute1": {
"id": 100000,
"label": "Red"
},
"attribute2": {
"id": 100005,
"label": "M"
},
"attribute3": null,
"suppliers": [
{
"id": 100003,
"supplier_sku": "DO8877",
"supplier": null
},
{
"id": 100005,
"supplier_sku": "DE1288912",
"supplier": null
}
],
"components": []
},
{
"id": 100366,
"sku": "B127621-4",
"type": "normal",
"label": "Bicycle for kids - Blue - M",
"barcode": "122657816782",
"initial_cost": null,
"purchase_price_amount": null,
"purchase_price_currency": null,
"weight_amount": null,
"weight_unit": "kg",
"track_inventory": true,
"on_hand": null,
"available": null,
"incoming": null,
"reserved": null,
"active": true,
"product": {
"id": 100315,
"suppliers": {
"data": [
{
"id": 100005,
"label": "deleniti"
},
{
"id": 100003,
"label": "dolor"
}
]
}
},
"attribute1": {
"id": 100002,
"label": "Blue"
},
"attribute2": {
"id": 100005,
"label": "M"
},
"attribute3": null,
"suppliers": [
{
"id": 100003,
"supplier_sku": "DO8877",
"supplier": null
},
{
"id": 100005,
"supplier_sku": "DE1288912",
"supplier": null
}
],
"components": []
}
]
},
"option1": {
"id": 100000,
"label": "Color"
},
"option2": {
"id": 100001,
"label": "Size"
},
"option3": null
}
}
}
UpdateProduct
Update a product
Parameters
id - ID |
---|
Id of the product |
input - ProductInput |
---|
Data to update |
Example
mutation UpdateProduct($id: ID!, $input: ProductInput!) {
UpdateProduct(id: $id, input: $input) {
id
active
}
}
{
"id": 1011232,
"input": {
"label": "My wonderful product",
"description": "Description of my wonderful product"
}
}
Returned data
{
"data": {
"UpdateProduct": {
"id": 1011232,
"active": true
}
}
}
DeleteProduct
Delete a product
Parameters
id - ID |
---|
Id of the product |
Example
mutation DeleteProduct($id: ID!) {
DeleteProduct(id: $id)
}
{
"id": 100009
}
Returned data
{
"data": {
"DeleteProduct": true
}
}
DisableProduct
Disable a product
Parameters
id - ID |
---|
Id of the product |
Example
mutation DisableProduct($id: ID!) {
DisableProduct(id: $id) {
id
active
}
}
{
"id": 100190
}
Returned data
{
"data": {
"DisableProduct": {
"id": 100190,
"active": false
}
}
}
EnableProduct
Enable a disabled product
Parameters
id - ID |
---|
Id of the product |
Example
mutation EnableProduct($id: ID!) {
EnableProduct(id: $id) {
id
active
}
}
{
"id": 100190
}
Returned data
{
"data": {
"EnableProduct": {
"id": 100190,
"active": true
}
}
}
ProductInput data type
label - String |
---|
Name of the product |
description - String |
---|
Description of the product |
active - Boolean |
---|
If true, the product is active and can be used in documents |
option1 - OptionInput |
---|
First option of the product (ex: color) |
option2 - OptionInput |
---|
Second option of the product (ex: size) |
option3 - OptionInput |
---|
Third option of the product (ex: material) |
variants - Array of VariantInput |
---|
List of the variants of the product based on options |
suppliers - Array of SupplierInput |
---|
Suppliers for this product |