Create purchase order
hub_create_purchase_orderWrite a new order to a supplier. It is created as a DRAFT — nothing reaches the supplier and no stock moves until send_purchase_order. PREREQUISITES, in this order: get_suppliers for the supplierId, get_outlets for the outlet the goods will be delivered INTO, then get_supplier_items WITH that outletId for the lines — variantId and unitCost come from there, and an item that is not linked to this supplier is refused. unitCost is what the merchant pays per unit as a human amount ("12.50"), prefilled from the supplier link but editable if this order was negotiated differently. quantity is in the item’s selling unit and may be fractional for goods sold by weight or length. Read the lines back to the merchant with the total before sending — a wrong quantity here becomes wrong stock later.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| lines | Yes | What to order | |
| notes | No | Note for the supplier / for the merchant’s own records | |
| discount | No | Flat discount on the whole order, e.g. "25.00". Not with discountPercent | |
| dutyFees | No | Duty / customs charged on the order | |
| outletId | Yes | Outlet id from get_outlets — where the goods will be received | |
| customFees | No | Any other named charge on the order, e.g. "Handling" | |
| supplierId | Yes | Supplier id from get_suppliers | |
| shippingFee | No | Shipping charged on the order, e.g. "18.00" | |
| expectedDate | No | ISO date the merchant expects delivery | |
| discountPercent | No | Discount as a percentage of the items subtotal |