Orders: list and search with cursor pagination, fetch one with line
items, and the lifecycle mutations (cancel, close, reopen, mark as
paid, tag). Requires the read_orders / write_orders scopes; orders
older than 60 days also need read_all_orders.
Values
ORDER_FIELDS
ORDER_FIELDS: Str "id name createdAt updatedAt processedAt cancelledAt cancelReason closedAt closed\ndisplayFinancialStatus displayFulfillmentStatus\nemail phone tags note test sourceName\ntotalPriceSet { shopMoney { amount currencyCode } }\ncurrentTotalPriceSet { shopMoney { amount currencyCode } }\ncustomer { id displayName defaultEmailAddress { emailAddress } }"
Functions
add-tags
fn (id: Str, tags: Vec<Str>): Str
fn (id: Str, tags: Vec<Str>, opts: Map): Str
Add tags to any taggable resource (order, product, customer, draft
order) by GraphQL id (tagsAdd). Returns the resource id.
Example
::shopify::orders/add-tags("gid://shopify/Order/1001", ["vip", "priority"])
// Another shop for this call
::shopify::orders/add-tags("gid://shopify/Order/1001", ["vip"], {shop: "acme", access-token: ::hot::ctx/get("acme.shopify.token")})
build-cancel-variables
fn (order-id: Str, reason: Str, restock: Bool, options: Map): Map
Variables for orderCancel. Options: notifyCustomer, staffNote,
refundMethod (e.g. {originalPaymentMethodsRefund: true}). Unset
options are omitted. Exposed for testing.
Example
vars ::shopify::orders/build-cancel-variables("gid://shopify/Order/1001", "CUSTOMER", true, {staffNote: "Duplicate"})
vars.reason // "CUSTOMER"
vars.staffNote // "Duplicate"
cancel-order
fn (order-id: Str, reason: Str, restock: Bool): Map
fn (order-id: Str, reason: Str, restock: Bool, options: Map): Map
fn (order-id: Str, reason: Str, restock: Bool, options: Map, opts: Map): Map
Cancel an order (orderCancel, asynchronous). reason is an
OrderCancelReason (CUSTOMER, DECLINED, FRAUD, INVENTORY,
STAFF, OTHER); restock returns committed inventory. Options:
notifyCustomer, staffNote, refundMethod (e.g.
{originalPaymentMethodsRefund: true}; authorized payments are voided
regardless). Returns {job, jobResult}; poll the job with node to
see it finish.
Example
::shopify::orders/cancel-order("gid://shopify/Order/1001", "CUSTOMER", true, {
refundMethod: {originalPaymentMethodsRefund: true},
notifyCustomer: true
})
close-order
fn (order-id: Str): Map
fn (order-id: Str, opts: Map): Map
Close (archive) an order (orderClose). Returns the order's id, name
and closedAt.
Example
order ::shopify::orders/close-order("gid://shopify/Order/1001")
order.closedAt
collect-orders
fn (options: Map, max-items: Int): Vec
fn (options: Map, max-items: Int, opts: Map): Vec
Follow cursors and return up to max-items orders (a Vec of nodes).
Options as in list-orders.
Example
orders ::shopify::orders/collect-orders({query: "financial_status:paid"}, 500)
map(orders, %.name)
get-order
fn (id: Str): Map?
fn (id: Str, opts: Map): Map?
One order by GraphQL id (gid://shopify/Order/...) with line items
(first 100) and shipping address. Returns null when not found.
Example
order ::shopify::orders/get-order("gid://shopify/Order/1001")
order.name
list-orders
fn (): Map
fn (options: Map): Map
fn (options: Map, opts: Map): Map
One page of orders. Options: first (default 50, max 250), after
(cursor), query (Shopify search syntax, e.g.
"financial_status:paid created_at:>=2026-10-01"), sortKey
(CREATED_AT, PROCESSED_AT, UPDATED_AT, TOTAL_PRICE, ...) and
reverse. Returns {nodes, pageInfo: {hasNextPage, endCursor}}.
Defaults to newest first.
Example
page ::shopify::orders/list-orders({first: 20, query: "fulfillment_status:unfulfilled"})
next ::shopify::orders/list-orders({first: 20, after: page.pageInfo.endCursor})
mark-order-as-paid
fn (order-id: Str): Map
fn (order-id: Str, opts: Map): Map
Record the outstanding balance as paid by a manual method
(orderMarkAsPaid). Needs the staff mark_orders_as_paid permission;
check the order's canMarkAsPaid first.
Example
order ::shopify::orders/mark-order-as-paid("gid://shopify/Order/1001")
order.id
remove-tags
fn (id: Str, tags: Vec<Str>): Str
fn (id: Str, tags: Vec<Str>, opts: Map): Str
Remove tags from a taggable resource by GraphQL id (tagsRemove).
Returns the resource id.
Example
::shopify::orders/remove-tags("gid://shopify/Order/1001", ["priority"])
reopen-order
fn (order-id: Str): Map
fn (order-id: Str, opts: Map): Map
Reopen a closed order (orderOpen).
Example
::shopify::orders/reopen-order("gid://shopify/Order/1001")