Ship orders
Use order shipment operations when a merchant integration needs to trigger shipment for all currently shippable quantities of an order, and to read back the tracking codes it has to forward to the end customer.
Available operations
- Read the orders of the shop with orders, or load one by global ID with order.
- Read order line items with orderLineItems, or load one by global ID with orderLineItem.
- Ship an order completely with shipOrderCompletely.
- Read the tracking codes of a shipped order from
Order.trackingCodes.
Example: ship an order
mutation ShipOrder($input: ShipOrderCompletelyInput!) {
shipOrderCompletely(input: $input) {
id
orderNumber
deliveryState
trackingCodes
}
}
{
"input": {
"orderId": "T3JkZXI6MDE4...",
"warehouseId": "V2FyZWhvdXNlOjAx..."
}
}
Pass warehouseId when shipment should use a specific warehouse. If it is omitted, Pickware uses the configured default warehouse.
What shipping does
shipOrderCompletely ships every quantity of the order that is not shipped yet, in one step:
- It takes the stock from the warehouse, from its bin locations and its unknown bin location, and books it onto the order, as stock movements with the process type
shipping. - It fires the Flow Builder event of Pickware for a completely or a partially shipped order. The flows Pickware ERP Completely Shipped and Pickware ERP Partially Shipped, which Pickware installs and activates, set the state of the order's delivery to
shippedorshipped_partially. Everything else that reacts to that state change runs as well, for example a Shopware flow that sends the shipping confirmation to the customer. - It sends the webhook topic
order/completely-shipped, ororder/partially-shippedwhen quantities of the order remain open afterwards. See Webhooks.
deliveryState in the mutation's response therefore depends on the shop's flows: when the merchant has deactivated or changed the two Pickware flows, it does not change. An order without a delivery fires neither the flow event nor the webhook.
When shipping fails
The mutation either ships all open quantities or nothing. It fails, and books no stock, when:
- the warehouse has
status: Decommissioning, - the warehouse does not hold enough stock for every open quantity, or
- a picking process for the order is in progress in Pickware WMS.
Example: read the tracking codes of an order
trackingCodes is a JSON array of strings and is readable on its own, so an integration that ships elsewhere can poll it to notify the end customer:
query OrderTrackingCodes($id: ID!) {
order(id: $id) {
orderNumber
deliveryState
trackingCodes
}
}
The field lists the tracking codes stored on the order's delivery in Shopware: those of the shipping labels created with Pickware for the order, across all of its parcels, and those entered on the delivery in the Shopware administration. It does not include the tracking codes of return labels. It is an empty array while the delivery has none, and null for an order without a delivery. An order with more than one delivery reports the codes of its primary delivery only.
shipOrderCompletely takes no tracking codes. Create the shipping labels with Pickware, or enter the codes in the administration, to have them listed here.