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.
Thanks!
Fabio
Leave an answer