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.
Related Posts:
- WP/WooCommerce REST API cart/checkout/order [closed]
- Creating woocommerce product using WordPress REST API
- Woocommerce REST API allow normal users make an order
- Expired session error (admin) when I try to make a call to WooCommerce api [closed]
- How can I get all the woocommerce api orders [closed]
- wc_get_products() not return the images details
- Woocommerce REST API – add filter to set maximum query per page for product brands [closed]
- Update Customer JWT Woocommerce
- WordPress SMS API integration without plugin error
- Absolute search against wordpress api
- WordPress Woocommerce REST API JSON Error
- Getting WordPress fatal error when hitting WooCommerce API
- woocommerce REST api on the website’s front-end
- How to save one API response to WooCommerce order meta data
- How can I get a get a list of customers from a list of email addresses?
- How to get WordPress to respond to a GET request at the end of a Woo product page
- Working with a json feed & trying to figure out how best to import
- Delete product image using WooCommerce API?
- email address non required
- WordPress returning “XHR” even when access keys are used
- How to programatically create a WooCommerce downloadable product?
- Users credentials and syncing from third party with WooCommerce
- Manual Woocommerce Complete order Emails
- WooCommerce REST API endpoints don’t exist
- Fetch products with filter by similar categories at same time
- Woocommerce API REST search by multiple keywords
- Create WordPress account on different domain when WooCommerce order completed
- Auto generating API keys using the Application Authentication Endpoint [closed]
- wc_get_template_part( ‘content’, ‘product’ ) | Where is this file located?
- how to get woocommerce product attribute slug
- Where can I find a single item template
- Get Woocommerce Subscription Product
- WooCommerce pages accessible to logged in members only
- paypal not showing on woocommerce payments
- Target WooCommerce Product Gallery Image (rather than Featured Image) for og:image
- How to update the WooCommerce cart Icon to show new products added with JavaScript
- Remove the link from the thumbnail and product title on woocommerce
- How to configure Woocommerce Payment Methods programmatically?
- woocommerce_package_rates not fired everytime
- how to change woocommerce shop archive description? [closed]
- Products Shortcode is Displaying Single Product Page Price for all Products [closed]
- Subscription on Checkout
- Woocommerce – display product in page but in list format with excerpt
- how to show store name when I add a product on cart in woocommerce(woocommerce multi store)?
- When Free shipping is available hide other shipping methods except Local pickup in WooCommerce [closed]
- Create archive page for woocommerce attribute
- How to increase execution time out limit in WordPress dashboard?
- Setting an attribute as variation in woo commerce via php [duplicate]
- WooCommerce – Conditionally enable shipping for virtual products
- Add to Cart button displaying twice on Shop Page Woocommerce
- How to exclude a taxonomy from shop & search page wooCommerce?
- How to remove unwanted text bug in wordpress site
- How to reverse/swap the order of “Sales price” and “Regular prcie” in woocommerce?
- Woocommerce Canceled Order Notification email to admin
- separate functions for home VS other pages
- WooCommerce apply shipping rates based on price
- WooCommerce Admin order – Only run action if user is loaded
- Creating child theme out of Coeur
- Hide sidebar and change layout Blog Page using is_page() function
- Change Out of Stock Error Message in WooCommerce Cart
- Woocommerce purchase date [closed]
- How to add a special Woocommerce “buy now” button?
- I want a simple dropdown for locations in woocommerce
- Getting hundreds of spam orders in WooCommerce with failed stripe payment [closed]
- How to fetch woocommerce highest price and lowest price in custom template page?
- Filter by Price filter button not working
- WooCommerce pagination: remove ‘page’ from url
- Coupon for product / woocommerce
- How can I show “sold out” instead of “out of stock” for some products with particular tags and categories [closed]
- Assign user role by text field in WordPress (Woocommerce) [closed]
- Urgent Validate Save-Post Hooks on Woo-commerce product entry form!
- MySQL error or data corruption after database migration
- My products are showing “not in stock” and I don’t know why
- Woocommerce change the price of products in the database
- Woocommerce – Shop can’t find products after domain name change
- “error_message”: “Sorry, you cannot list resources.” using WooCommerce API
- WooCommerce product details page category display
- Woocommerce – Default product image by user role
- login or register then access woocommerce website
- Move woocommerce shop page image to left
- WooCommerce Tax Filter Not Working
- WooCommerce does not translate every string
- Woocommerce add a text field if specific option is selected
- Add suffix to price html does not work
- Woocommerce Product category base same as product base causes 404
- Categories and products in cart Woocommerce
- SyntaxError: unterminated string literal – if WordPress Debug in wp-config is set to true
- How Fragile Is DB if I Upload Completely Updated Files
- Broken 302 redirection for product subcategory (Woocommerce, Apache)
- How to allow registration only from a certain location?
- Add confirmation popup on place order button
- Change WooCommerce Checkout Button – Reverts to normal
- Can’t display product categories on woocommerce getting Invalid taxonomy?
- Send form data to functions.php
- Translate Woocommerce tab
- Woocommerce -> gallery images per variation without a plugin? [closed]
- Why is my WordPress admin not working
- Create bookings after subscription renewal
- Change variants URL
- Use a woocommerce hook to create a table and populate it with a query