Create an order
Note: This mutation can be used only for companies that can create orders. Most companies have connected Stockpit with another application, and orders are automatically created from orders of this third party application.
GraphQL
mutation {
CreateOrder (
input: {
label: "Order#1234"
customer: {
id: 100123
}
line_items: [
{
quantity:10
variant: {
id: 100751
}
location: {
id:100020
}
},
{
quantity:20
variant: {
id: 100759
}
location: {
id:100020
}
batch_numbers:[
{
batch_number:{
id:189000
}
quantity:12
},
{
batch_number:{
id:189666
}
quantity:8
}
]
}
],
update_on_hand: false,
}
){
id
}
}
JSON
{
"data": {
"CreateOrder": {
"id": 101122
}
}
}
Update an order
GraphQL
mutation UpdateOrder($id: ID!, $input: OrderInput!) {
UpdateOrder(id: $id, input: $input) {
id
status
}
}
Variables (JSON)
{
"id": 100010,
"input": {
"notes": "pHsSMebxYQ",
"shipping_at": "2023-01-14",
"customer": {
"id": 100012
},
"line_items": [
{
"id": 100213,
"quantity": 7,
"weight": 0,
"location": {
"id": 100010,
},
"variant": {
"id": 100337
}
},
{
"id": 100214,
"quantity": 41,
"weight": 1,
"location": {
"id": 100010,
},
"variant": {
"id": 100338
},
"batch_numbers":[
{
"batch_number":{
"id":189000
},
"quantity":20
},
{
"batch_number":{
"id":189666
},
"quantity":21
}
]
}
]
}
}
JSON
{
"data": {
"UpdateOrder": {
"id": 1011232,
"status": "active"
}
}
}
Create a shipping order document based on an order
GraphQL
mutation TransformIntoShippingOrder($id: ID!) {
TransformIntoShippingOrder(id: $id) {
id
label
status
dated_at
}
}
JSON
{
"data": {
"TransformIntoShippingOrder": {
"id": 100010,
"label": "SHO00000011",
"status": "unpublished",
"dated_at": "1996-12-31"
}
}
}
Create a product return document based on an order
GraphQL
mutation TransformIntoProductReturn($id: ID!) {
TransformIntoProductReturn(id: $id) {
id
label
status
dated_at
}
}
JSON
{
"data": {
"TransformIntoProductReturn": {
"id": 100010,
"label": "PRO00000011",
"status": "unpublished",
"dated_at": "2024-02-08"
}
}
}
label - String Name of the order
notes - String Notes of the order
total_units - Float Total units sold in the order
status - String Status of the order : active, archived, cancelled, completed or unpublished
update_on_hand - Boolean Define if the order update the on hand stocks
line_items - Array of LineItemOrderInput Line items of the order
dated_at - Date Date of the order
shipping_at - Date Shipping date of the order
shipping_address - AddressInput Address the order will be shipped to