Mutations

See the Queries page for a presentation of this resource.

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
product
Product of the variant (product { id: 100005 } )
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)
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

SupplierSkusInput data type

id
Identifier of the supplier
supplier_sku
SKU used by the supplier for this variant

AttributeVariantInput data type

id
Identifier of the attribute
attribute
Attribute linked to the variant

VariantComponentInput data type

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