See the Queries page for a presentation of this resource.
Create a variant
Note: This mutation can be used only for companies who can create variants.
input Data of the variant
GraphQL
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
}
}
JSON
{
"data": {
"CreateVariant": {
"id": 100367,
}
}
}
Update a variant
input Data of the variant
GraphQL
mutation UpdateVariant($id: ID!, $input: VariantInput!) {
UpdateVariant(id: $id, input: $input) {
id
sku
}
}
Variables (JSON)
{
"id": 1011232,
"input": {
"sku": "pHsSMebxYQ"
}
}
JSON
{
"data": {
"UpdateVariant": {
"id": 1011232,
"sku": "pHsSMebxYQ"
}
}
}
Delete a variant
GraphQL
mutation DeleteVariant($id: ID!) {
DeleteVariant(id: $id)
}
JSON
{
"data": {
"DeleteVariant": true
}
}
Disable a variant
GraphQL
mutation DisableVariant($id: ID!) {
DisableVariant(id: $id) {
id
active
}
}
JSON
{
"data": {
"DisableVariant": {
"id": 100009,
"active": false
}
}
}
Enable a disabled variant
GraphQL
mutation EnableVariant($id: ID!) {
EnableVariant(id: $id) {
id
active
}
}
JSON
{
"data": {
"EnableVariant": {
"id": 100009,
"active": true
}
}
}
id Unique identifier of the variant
product Product of the variant (product { id: 100005 } )
label Name of the variant
suppliers Suppliers for the variant
barcode Barcode of the variant
type Type of the variant (normal, kit, assembly, packaging)
components Components of the variant for a kit or an assembly
track_inventory If true, the inventory is tracked (changed based on documents, adjustments, ...)
has_batch_numbers If true, activate the batches for the variant (once activated, it will be possible to allocate batch numbers)
initial_cost Initial cost of the variant
weight_amount Weight of the variant
weight_unit Unit for the variant's weight (kg, g, lb, oz)
weight Computed weight of the variant
attributes Attributes of the variant
initial_stock_level Stock level on the creation of the variant
initial_location Initial location of the variant
hs_code HS code of the variant
id Identifier of the supplier
supplier_sku SKU used by the supplier for this variant
id Identifier of the attribute
attribute Attribute linked to the variant
id Unique identifier of the variant component
variant_id Identifier of the parent variant
component_id Identifier of the component variant
quantity Quantity of the component used in the variant