Mutations

CreateVariant

Create a variant

Note: This mutation can be used only for companies who can create variants.

Parameters

input
Data of the variant

Example

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
  }
}

Returned data

{
  "data": {
    "CreateVariant": {
      "id": 100367,
    }
  }
}

UpdateVariant

Update a variant

Parameters

id
Id of the variant
input
Data of the variant

Example

mutation UpdateVariant($id: ID!, $input: VariantInput!) {
  UpdateVariant(id: $id, input: $input) {
    id
    sku
  }
}
{
  "id": 1011232,
  "input": {
    "sku": "pHsSMebxYQ"
  }
}

Returned data

{
  "data": {
    "UpdateVariant": {
      "id": 1011232,
      "sku": "pHsSMebxYQ"
    }
  }
}

DeleteVariant

Delete a variant

Parameters

id
Id of the variant

Example

mutation DeleteVariant($id: ID!) {
  DeleteVariant(id: $id)
}
{
  "id": 100009
}

Returned data

{
  "data": {
    "DeleteVariant": true
  }
}

DisableVariant

Disable a variant

Parameters

id
Id of the variant

Example

mutation DisableVariant($id: ID!) {
  DisableVariant(id: $id) {
    id
    active
  }
}
{
  "id": 100009
}

Returned data

{
  "data": {
    "DisableVariant": {
      "id": 100009,
      "active": false
    }
  }
}

EnableVariant

Enable a disabled variant

Parameters

id
Id of the variant

Example

mutation EnableVariant($id: ID!) {
  EnableVariant(id: $id) {
    id
    active
  }
}
{
  "id": 100009
}

Returned data

{
  "data": {
    "EnableVariant": {
      "id": 100009,
      "active": true
    }
  }
}

VariantInput data type

id
Unique identifier of the variant
label
Name of the variant
sku
Sku of the variant
suppliers
Suppliers for the variant
barcode
Barcode of the variant
type
Type of the variant (normal, kit, assembly, packaging)
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
initial_stock_level
Stock level on the creation of the variant
purchase_price_amount
Purchase price of the variant
purchase_price_currency
Currency of the purchase price (GBP, USD, ...)
weight_amount
Weight of the variant
weight_unit
Unit for the variant's weight (kg, g, lb, oz)
attribute1
Variant attribute for the first option of the product (ex: "red" for Color option)
attribute2
Variant attribute for the second option of the product (ex: "XL" for Size option)
attribute3
Variant attribute for the third option of the product (ex: "iron" for Material option)
product
Product of the variant ( product { id: 1020012 } )
initial_location
Initial location of the variant