Mutations

See the Queries page for a presentation of this resource.

CreateBatchNumber

Create a batch number

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

Parameters

input
Data of the batch number

Example

mutation {
  CreateBatchNumber(
    input: {
      label: "my batch",
      barcode: "123456789",
      expiry_date: "2024-04-24",
      variant: {
        id: 100359
      }
    }
  ) {
    id
  }
}

Returned data

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

CreateBatchNumbers

Same as CreateBatchNumber, but you can create multiple batch numbers by passing an array of batch data

UpdateBatchNumber

Update a Batch number

Parameters

id
Id of the batch number
input
Data of the batch number

Example

mutation UpdateBatchNumber($id: ID!, $input: BatchNumberInput!) {
  UpdateBatchNumber(id: $id, input: $input) {
    id
    label
  }
}
{
  "id": 100047,
  "input": {
    "label": "batch1233"
  }
}

Returned data

{
  "data": {
    "UpdateBatchNumber": {
      "id": 100047,
      "label": "batch1233"
    }
  }
}

UpdateBatchNumbers

Same as UpdateBatchNumber, but you can update multiple batch numbers by passing an array of batch data

DeleteBatchNumber

Delete a batch number

Parameters

id
Id of the batch number

Example

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

Returned data

{
  "data": {
    "DeleteBatchNumber": true
  }
}

AllocateBatchNumber

Allocate batch numbers to stock not allocated

Parameters

input
Data of the batch number

Example

mutation AllocateBatchNumber($input: [BatchNumberStockLevelInput]!) {
  AllocateBatchNumber(input: $input) {
    id
    on_hand
    location {
      id
      label
    }
    variant {
      id
      label
    }
    batch_number {
      id
      label
      barcode
      expiry_date
    }
  }
}
{
  "input": [
    {
      "quantity": 12,
      "location": {
        "id": 100000,
        "label": "Default location"
      },
      "variant": {
        "id": 100359
      },
      "batch_number": {
        "id": -1,
        "label": "batchasicssneak1",
        "barcode": "234567",
        "expiry_date": "2024-04-26",
        "variant": {
          "id": 100359
        }
      }
    }
  ]
}

Returned data

{
  "data": {
    "AllocateBatchNumber": [
      {
        "id": 100041,
        "on_hand": 12,
        "location": {
          "id": 100000,
          "label": "Default location"
        },
        "variant": {
          "id": 100359,
          "label": "Amazing Asics Sneakers"
        },
        "batch_number": {
          "id": 100048,
          "label": "batchasicssneak1",
          "barcode": "234567",
          "expiry_date": "2024-04-26"
        }
      }
    ]
  }
}

BatchNumberInput data type

id
Unique identifier of the batch number
label
Name of the batch
barcode
Barcode of the variant
expiry_date
expiry date of the batch
variant
Variant data ( variant { id: 1020012 } )

BatchNumberLineItemInput data type

id
Unique identifier of the batch number line item
quantity
Quantity of the variant allocated to this batch number for the line item
batch_number
Batch number allocated to the line item ( batch_number { id: 189000 } )

BatchNumberStockLevelInput data type

id
Unique identifier of the batch number stock level
quantity
Quantity of stock to allocate to this batch number for this variant at this location
variant
Variant to allocate the batch number to
location
Location to allocate the batch number to
batch_number
Batch number to allocate to the stock