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

Assuming you are not allowed guest checkout what you can try is

  • add a custom field to your WooCommerce products in which you would save the history of purchases as an array like [<user_id_1>, <user_id_2>, ...];
  • write a custom function and use a woocommerce_order_status_completed hook to update this field according to products within the order (see this question for information on how to get user ID from the WooCommerce order);
  • write a function which will do a loop through all already placed orders and initialize that field value for each of your products.

This can be done as a plugin where initialization of this custom field will occur during plugin activation. And with the same plugin you could register an additional REST API endpoint.