I have an oddly specific challenge, displaying the total count of products in orders of a specific order status. So let's say there's 52 orders with the order status "Processing", I'm trying to retrieve a total count of line items in those orders to then display on the front end.
Example: "Customers like you are playing with 6,829 Fidget Spinners right now!"
Where the number would essentially be a total count of line items in orders with the "Completed" order status.
I think I understand how to achieve this from a logical standpoint — run a query to filter the database for orders of a specific order status, then retrieve the total line items in each order, and add those all together, but I'm struggling to understand how that translates in code, I'm a front end dev.
Any pointers would be greatly appreciated, thank you kindly.