Frontend API
Methods to manage orders placed by a customer.
Return a list of orders placed by a customer, with offset pagination using limit and page.
You can also use the same method to return orders that have shipments with tracking information.
await swell.account.listOrders({
limit: 10,
page: 2
})
Return a single account order by ID.
await swell.account.getOrder('5fab561fb4a4d83c776f45bd')
Methods to manage orders placed by a customer.
List account orders
Return a list of orders placed by a customer. The parameters for the getOrders query are _locale and _currency.
You can also use the same query to return shipments with tracking information.
query getOrders {
account {
orders {
id
dateCreated
number
accountId
items {
productId
price
quantity
}
grandTotal
paid
delivered
billing {
firstName
lastName
address1
city
zip
state
country
}
shipping {
firstName
lastName
address1
city
zip
state
country
}
}
}
}Get an account order
Return a single account order by order ID or order number.
The parameters for the getOrderById query are id (required), _locale, and _currency.
The parameters for the getOrderByNumber query are number (required), _locale, and _currency.
query getOrderById {
orderById(id: "62acbadb3edcc300128d4178") {
id
dateCreated
accountId
items {
productId
price
quantity
}
grandTotal
paid
delivered
billing {
firstName
lastName
address1
city
zip
state
country
}
shipping {
firstName
lastName
address1
city
zip
state
country
}
}
}