API Reference

CreateVariant

Create a variant

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

Parameters

input - VariantInput
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
Id of the variant
input - VariantInput
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
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
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
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 - 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 } )
initial_location - LocationInput
Initial location of the variant