Fulfillment through fulfillment orders, Shopify's current model: list
an order's fulfillment orders, fulfil them (all items or chosen
quantities) with tracking, and update tracking afterwards. Needs one
of the write_merchant_managed_fulfillment_orders,
write_assigned_fulfillment_orders or
write_third_party_fulfillment_orders scopes.
Functions
build-fulfillment-input
fn (line-items: Any, tracking: Map?, options: Map): Map
FulfillmentInput for fulfillmentCreate. line-items is a Vec of
{fulfillmentOrderId, fulfillmentOrderLineItems?: [{id, quantity}]}
(omit the line items to fulfil everything remaining), or a single
fulfillment order id Str. Options: notifyCustomer, originAddress.
Exposed for testing.
build-tracking-input
fn (tracking: Map?): Map?
FulfillmentTrackingInput from {company, number, url} or {company, numbers, urls} (multi-package). Unset fields are omitted; returns null when nothing is set. Exposed for testing.
create-fulfillment
fn (line-items: Any, tracking: Map?): Map
fn (line-items: Any, tracking: Map?, options: Map): Map
fn (line-items: Any, tracking: Map?, options: Map, opts: Map): Map
Fulfil one or more fulfillment orders (fulfillmentCreate) with
optional tracking. Pass a fulfillment order id to fulfil all of its
remaining items, or a Vec of {fulfillmentOrderId, fulfillmentOrderLineItems: [{id, quantity}]} for partial quantities.
Options: notifyCustomer, originAddress, message. Returns the
fulfillment (id, status, trackingInfo).
Example
fos ::shopify::fulfillments/list-fulfillment-orders(order.id, {query: "status:open"})
::shopify::fulfillments/create-fulfillment(first(fos.nodes).id, {
company: "UPS",
number: "1Z001985YW99744790"
}, {notifyCustomer: true})
list-fulfillment-orders
fn (order-id: Str): Map
fn (order-id: Str, options: Map): Map
fn (order-id: Str, options: Map, opts: Map): Map
One page of an order's fulfillment orders: id, status, assigned
location, supported actions and line items with remainingQuantity.
Options: first, after, query (e.g. "status:open"). Returns a
connection {nodes, pageInfo}.
update-tracking
fn (fulfillment-id: Str, tracking: Map): Map
fn (fulfillment-id: Str, tracking: Map, notify-customer: Bool): Map
fn (fulfillment-id: Str, tracking: Map, notify-customer: Bool, opts: Map): Map
Replace a fulfillment's tracking (fulfillmentTrackingInfoUpdate). tracking as in create-fulfillment; notify-customer emails the customer about this and later updates.