Create a variant
Note: This mutation can be used only for companies who can create variants.
mutation {
CreateVariant(
input: {
sku: "12RTU1",
type: "normal",
label: null,
barcode: "123456789",
weight_amount: 12,
weight_unit: "kg",
track_inventory: true,
initial_cost: 10,
purchase_price_amount: null,
purchase_price_currency: "EUR",
suppliers: [
{
id: 100009,
supplier_sku: "U12G5678"
}
],
components: [],
product: {
id: 100005
},
attribute1: {
id: 100004,
label: "Green"
},
attribute2: {
id: 100003,
label: "S"
}
}
) {
id
}
}
{
"data": {
"CreateVariant": {
"id": 100367,
}
}
}
Update a variant
| id - ID |
|---|
| Id of the variant |
mutation UpdateVariant($id: ID!, $input: VariantInput!) {
UpdateVariant(id: $id, input: $input) {
id
sku
}
}
{
"id": 1011232,
"input": {
"sku": "pHsSMebxYQ"
}
}
{
"data": {
"UpdateVariant": {
"id": 1011232,
"sku": "pHsSMebxYQ"
}
}
}
Delete a variant
| id - ID |
|---|
| Id of the variant |
mutation DeleteVariant($id: ID!) {
DeleteVariant(id: $id)
}
{
"data": {
"DeleteVariant": true
}
}
Disable a variant
| id - ID |
|---|
| Id of the variant |
mutation DisableVariant($id: ID!) {
DisableVariant(id: $id) {
id
active
}
}
{
"data": {
"DisableVariant": {
"id": 100009,
"active": false
}
}
}
Enable a disabled variant
| id - ID |
|---|
| Id of the variant |
mutation EnableVariant($id: ID!) {
EnableVariant(id: $id) {
id
active
}
}
{
"data": {
"EnableVariant": {
"id": 100009,
"active": true
}
}
}
| id - Int |
|---|
| Unique identifier of the variant |
| label - String |
|---|
| Name of the variant |
| sku - String |
|---|
| Sku of the variant |
| suppliers - Array of SupplierInput - Subquery |
|---|
| Suppliers for the variant |
| barcode - String |
|---|
| Barcode of the variant |
| type - String |
|---|
| Type of the variant (normal, kit, assembly, packaging) |
| track_inventory - Boolean |
|---|
| If true, the inventory is tracked (changed based on documents, adjustments, ...) |
| has_batch_numbers - Boolean |
|---|
| If true, activate the batches for the variant (once activated, it will be possible to allocate batch numbers) |
| initial_cost - Float |
|---|
| Initial cost of the variant |
| initial_stock_level - Float |
|---|
| Stock level on the creation of the variant |
| purchase_price_amount - Float |
|---|
| Purchase price of the variant |
| purchase_price_currency - String |
|---|
| Currency of the purchase price (GBP, USD, ...) |
| weight_amount - Float |
|---|
| Weight of the variant |
| weight_unit - String |
|---|
| Unit for the variant's weight (kg, g, lb, oz) |
| attribute1 - AttributeInput |
|---|
| Variant attribute for the first option of the product (ex: "red" for Color option) |
| attribute2 - AttributeInput |
|---|
| Variant attribute for the second option of the product (ex: "XL" for Size option) |
| attribute3 - AttributeInput |
|---|
| Variant attribute for the third option of the product (ex: "iron" for Material option) |
| product - ProductInput |
|---|
| Product of the variant ( product { id: 1020012 } ) |