create_fulfillment
Mark items as shipped by creating a fulfillment record. Supports partial fulfillment, tracking info, and customer notification.
Instructions
Mark items as shipped — creates a fulfillment record covering one or more fulfillment orders. For each fulfillment order in the request, you can either fulfill everything still remaining (omit fulfillmentOrderLineItems) or specify per-line {id, quantity} pairs for partial shipments. Optionally attach tracking info (carrier + number; URL is auto-derived for major carriers like USPS/UPS/FedEx/DHL) and set notifyCustomer=true to send the shipment-confirmation email. The fulfillmentOrderLineItem IDs come from list_fulfillment_orders. Side effects: customer-facing email if notifyCustomer is true; webhook fires; remaining quantities decrement.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| lineItemsByFulfillmentOrder | Yes | One entry per fulfillment order being fulfilled in this shipment. | |
| trackingInfo | No | Tracking info. Company+number is enough; Shopify auto-derives URL for known carriers. | |
| notifyCustomer | No | Send the customer a shipment notification email. |
Implementation Reference
- src/shopify/client.ts:65-75 (helper)throwIfUserErrors helper used by the handler to check and throw on Shopify API user errors.
export function throwIfUserErrors( errors: ShopifyUserError[] | undefined, operation: string, ): void { if (!errors || errors.length === 0) return; const messages = errors .map((e) => (e.field ? `${e.field.join(".")}: ${e.message}` : e.message)) .join("; "); throw new Error(`Shopify ${operation} userErrors: ${messages}`); }