Woocommerce, finding the ordinal number of a purchase for a certain product


we are developing a complex Woocommerce website and an app which uses V3 API.

Being sold products very valuable, we need to know the ordinal number of a purchase for each product. For example, we’d like to know that Alice was the third to buy that product and Bob the fifth and so on.
What I can think of is to get the total sales through Woocommerce API for that product, then loop every order containing that product and order them by date. The problem is that this way is very time and resources consuming, especially having to loop through all the orders.
Does anybody know a better approach. I don’t ask for the code, but I’d be glad if someone could have a brilliant approach to share.


, Fabio Ricci 3 years 2020-07-04T15:10:40-05:00 0 Answers 79 views 0

Leave an answer