Create new Purchase Order
Endpoint: https://po.mimoran.com/api/v1/graphql.php
mutation {
createPurchaseOrder(
purchase_code: "string"
po_date: "string" //Eg: "2023-10-25"
expected_date: "string" //Eg: "2023-10-25"
currency: "string" //Eg: "USD"
ship_to_name: "string"
ship_to_address: "string"
discount_label: "string"
discount_amount: "float"
tax_label: "string"
tax_amount: "float"
shipping_label: "string"
shipping_amount: "float"
supplier_id: int //ID from the suppliers query. Do not send together with vendor_name
vendor_name: "string" //Shopify vendor name. Do not send together with supplier_id
status: "string" //Eg: "confirm". Default: "pending"
items: [
{
variant_id: "string"
product_supplier_sku: "string"
qty_ordered: "float"
cost: "float"
qty_received: "float" //recorded on the PO only, Shopify inventory is not changed
}
]
) {
purchase_order_id
purchase_code
po_date
expected_date
currency
supplier_id
supplier_name
ship_to_name
ship_to_address
discount_label
discount_amount
discount_type
tax_label
tax_amount
shipping_label
shipping_amount
po_reference
po_from
parent_id
archived
status
created_at
updated_at
items {
purchase_order_product_id
product_id
variant_id
inventory_item_id
product_name
product_sku
product_supplier_sku
variant_name
product_image
qty_ordered
qty_received
cost
sales_price
discount
tax
product_from
}
}
}
Notes:
supplier_id: use asupplier_idreturned by the suppliers query. To assign a Shopify vendor instead, sendvendor_name(the PO is then saved withsupplier_id= 0 andsupplier_name= the vendor name). Do not send both.status: one ofpending,sent,accepted,unaccepted,confirm,transferring,completed,canceled,closed. The PO is saved with exactly this status. Setting a status only saves it: no email is sent to the supplier and nothing is updated in Shopify.qty_received: recorded on the PO only (Received quantity and receiving history). Shopify inventory, cost and price are not changed. It must be between 0 andqty_ordered. Ifstatusis not sent but anyqty_receivedis, the PO status is set from the quantities (transferringorcompleted). To receive stock into Shopify, use receivePurchaseOrder withlocation_id.- If any argument is invalid (unknown
status,supplier_idnot found,qty_receivedout of range...), no Purchase Order is created and the reason is returned inerrors[0].message.
Example: confirmed PO for a supplier, with items already received
Creates a PO for supplier 12, saves it as confirm, and records that 3 of the 10 units were already received. Shopify inventory stays the same; the remaining 7 units can be received later in the app or with receivePurchaseOrder.
mutation {
createPurchaseOrder(
purchase_code: "PO-1001"
po_date: "2026-10-30"
currency: "USD"
supplier_id: 12
status: "confirm"
items: [
{ variant_id: "44012345678901", qty_ordered: 10, cost: 5.5, qty_received: 3 }
]
) {
purchase_order_id
supplier_id
supplier_name
status
items {
purchase_order_product_id
variant_id
qty_ordered
qty_received
}
}
}
To use a Shopify vendor instead of a supplier, replace supplier_id: 12 with vendor_name: "Acme Goods".
Example error response (unknown status, no PO created):
{
"errors": [
{ "message": "status must be one of: pending, sent, accepted, unaccepted, confirm, transferring, completed, canceled, closed" }
],
"data": { "createPurchaseOrder": null }
}