Covers all questions related to inventory management, order fulfillment, and shipping.
I've been asked by a client to include some fulfillments per time period data seen in the attached image in a daily text message which programmatically gets sent out.
As you can see, it's very easy to access this information through Shopify reports. But I can't find a way to simply access this information through a single API call in either REST or GraphQL. It looks to me like I'll need to get every order with an "updated_at" date of "after the start of today", then iterate through every order's fulfillments and get counts to recreate the screenshot.
This seems kinda absurd to me and I assume I'm missing something, anyone come across this/find a simpler solution?
Hi,
did you try
https://shopify.dev/docs/api/admin-rest/2024-04/resources/order#get-orders-count?status=any
may be you can save the result into a json and save it for further use.
I would love to be able to use that endpoint, but from what I can tell, I'm unable to filter by "fulfillment_created_at" date. If I were, that would be amazing.
I understand that I can filter by fulfillment status, but that doesn't help me get orders fulfilled within the last 24 hours, or 1 hour, or X time period.
You may say- "But you can filter by order "created_at" date and fulfillment_status of "shipped", but that gets me orders which were created within a time period and fulfilled, but if my order was created 3 days ago and was fulfilled today, it wouldn't be counted if I set order created_at date to "today".
As you can see in the screenshot in my original post, Shopify is able to quickly/easily get all orders which were fulfilled within a time period, independent of when the order was created. That's what I'm looking to get from the API.
Hi,
why not use of admin-graphql.
it will give you all closed fulfillment orders for a specific location and for a specific date.
you can save the data one time in json and then just save daily result and you can make it.
and please use cursor for next page. just take the data day wise.
If you want i can make an simple CURL for this Graph-Ql.
curl --silent --location --request POST 'https://**************.myshopify.com/admin/api/2024-04/graphql.json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic Nm**************************************************************************I=' \
--data '{"query":"{\r\n fulfillmentOrders(first: 250, query:\"assigned_location_id:61******03 status:CLOSED updated_at:2022-05-16\",includeClosed:true\r\n ) {\r\n edges {\r\n cursor\r\n node {\r\n id \r\n status\r\n createdAt\r\n updatedAt\r\n assignedLocation {\r\n location {\r\n id\r\n }\r\n }\r\n }\r\n }\r\n pageInfo{\r\n\r\n hasNextPage\r\n endCursor\r\n hasPreviousPage\r\n startCursor\r\n }\r\n }\r\n }","variables":{}}'
I could do this, but this is what I was trying to avoid in hopes of a more direct/simple solution. That's why I reached out to the Shopify community, I was hoping that this would be a common enough situation that someone would have a simpler solution for, instead of going through every FulfillmentOrder and counting them myself.
For example, when I want to find out how many orders were shipped domestic/international over a time period, I run this ShopifyQL query:
FROM orders
SHOW sum(orders) AS "orders"
GROUP BY shipping_country
SINCE 2023-12-01T00:00:00 UNTIL today
limit 1000
Instead of running that query, I could use GraphQL or REST to look at the shipping country of every order within a time period and add them all up myself, but that would be silly because there's a much simpler/easier way to do that.
I was hoping there would be a similarly simple way to get the number of fulfilled orders within a time period without having to count and add them all myself, but so far it's looking like this isn't the case.
I assume you never got an answer to this?