Magento can find orders by the date they were placed. A rental business almost never wants that — it wants the orders going out this morning, the ones due back this afternoon, everything that is out over a bank holiday weekend, and anything overdue. rentalOrders answers those, searching on the rental dates rather than the order date.
It needs a token holding SalesIgniter_Rental::rentalcal.
The four questions #
At least one of these four filters is required — there is no unfiltered form, because a query over every order a store has ever taken is not a useful default.
| Filter | Finds | Use it for |
|---|---|---|
starting_between: {from, to} | Orders with a rental item starting in the range. | Today’s collections. The picking list. |
ending_between: {from, to} | Orders with a rental item ending in the range. | Today’s returns. Tomorrow’s expected stock. |
out_during: {from, to} | Orders whose rental period overlaps the range at any point. | What is off the shelf over a weekend, regardless of when it left. |
overdue_as_of: "…" | Orders with items that should have come back by this moment and have not. | The chase list. |
These search the customer-facing start_date/end_date, not the turnover-inclusive ones. When you ask what is going out today you mean the customer’s collection time, not the hour the van was loaded.
Today’s collections #
query GoingOutToday {
rentalOrders(
filter: { starting_between: { from: "2026-10-03", to: "2026-10-03" } }
sort: { rental_start_date: ASC }
pageSize: 50
) {
total_count
items {
order_id
increment_id
status
customer_name
customer_email
rental_start_date
rental_end_date
items {
sku
name
qty_ordered
reservation {
id
qty
qty_shipped
state
serials_shipped
source_code
}
}
}
page_info { current_page total_pages }
}
}
A bare Y-m-d in to is widened to the end of that day, so {from: "2026-10-03", to: "2026-10-03"} means all of the 3rd rather than the single instant of midnight. Supply a time if you want a narrower window.
The chase list #
query Overdue {
rentalOrders(
filter: { overdue_as_of: "2026-10-03 18:00:00" }
sort: { rental_end_date: ASC }
) {
total_count
items {
increment_id
customer_name
customer_email
rental_end_date
items {
sku
reservation { qty_shipped qty_returned serials_shipped state }
}
}
}
}
overdue_as_of means “past its end date and units still with the customer” — it counts what has gone out against what has come back, so an order that ended last week and was returned on time is not on the list. Fully cancelled lines are excluded too.
Combining filters #
Date filters combine with AND, and the non-date filters (product_id, sku, status, customer_email, source_code, store_id) narrow further. This asks what cameras are leaving the Manchester depot next week on orders that are actually processing:
rentalOrders(filter: {
starting_between: { from: "2026-10-05", to: "2026-10-11" }
sku: { in: ["CANON-R6", "SONY-FX3"] }
status: { eq: "processing" }
source_code: { eq: "manchester" }
}) { total_count items { increment_id rental_start_date } }
What comes back #
- Paging is over orders, not bookings. An order with three matching rental lines counts once in
total_countand fills one slot inpageSize. This is what makes the query usable to drive a screen. itemsholds only the matching rental lines. An order with ten lines of which one is going out today returns that one line, not the other nine — you are looking at a picking list, not an invoice.rental_start_dateandrental_end_dateon the order are the earliest start and latest end across its matching lines, which is what you want at the top of a job sheet.- A line split across two bookings (two depots, or a partial send) appears once per booking. That is deliberate — each booking is a separate thing to pick, send and take back.
- Manual holds never appear here. A hold placed from the admin with no order behind it is not an order; find those with
rentalReservations. - Guest orders still return a
customer_name, taken from the billing address.
Sorting #
Sort on rental_start_date, rental_end_date, created_at or order_id. The default is rental_start_date: ASC — the order of the working day. The two rental sorts use the earliest start and latest end on each order, so the sequence is the one a driver would actually follow. Supply exactly one sort field.
