How do I get the item sales quantity for each business day to track my sales inventory? Does anyone have any idea to get each item’s sales quantity made in a business day (more than 500 orders) and pass it into my database? Or maybe which API(s) am I supposed to use to get the item sales?
With the Orders API you can get all the itemized orders from sales which include the quantity sold. You will also have to use the Catalog API to get the item information from the
item_variation_id that is in the order.
Hi @Bryan-Square ,
If I would to use the Orders API, do I use the ‘Search Orders’, ‘Retrieve Order’, or ‘Batch Retrieve Orders’. Because using the ‘Search Orders’ I am only able to get back the Order_IDs and the Location_IDs.
However, if I would to use the ‘Retrieve Order’ or ‘Batch Retrieve Orders’, I would need to get all the Order_IDs made in a business day which I do not know how to pass the the output I received from the ‘Search Orders’ into the input of the ‘Batch Retrieve Orders’.
Can you clarify
what you mean by this?
SearchOrders definitely returns full
Order objects, which would include itemization information. You shouldn’t need to pass the ids from
BatchRetrieveOrders, as they would return the same information.
When using the ‘Search Orders’ function Square\Models\SearchOrdersRequest, I can only get back OrderId and LocationId as my output.
I am using the code from this link:
In the link you provided, you can see SearchOrders returns: square-php-sdk/search-orders-response.md at master · square/square-php-sdk · GitHub, which has an array of literal Order objects. The
Order object has everything that you would need. Let me know if I’m misunderstanding, though.
The SearchOrders actually returns a
SearchOrdersResponse object which has:
So I’m actually not sure where you’re only seeing order id and location id. The
Order object definitely has the order id as well as the location id, but among other things (lineItems, fulfillments, totals, tenders, etc).
Hi would you mind helping me out by viewing my code I am currently using the SearchOrderRequest if I am not wrong. I have posted it on StackOverflow link is right below.
Edited: Found the solution, where I just have to set return entry to false to get every details of the order. However, still could not get back JUST the item name sold, item quantity sold and catalog_id and place it into three different array for me to insert into my database.