Why API? You can use WordPress and Woocommerce built in functions.
What is the best way to generate a list of orders for Product X, without the API?
Using the API it is quite simple:
$woocommerce->get(‘orders’, [‘product’=>$product_id])
This user had to make a custom MySQL query. Is there a better way? https://wordpress.org/support/topic/how-to-show-all-orders-details-for-specific-or-particular-product-in-woocommerce-1/#post-7129458
SELECT i.order_id FROM
abc_woocommerce_order_items AS i
INNER JOIN abc_woocommerce_order_itemmeta AS im
ON i.order_item_id=im.order_item_id
WHERE im.meta_key='_product_id' AND im.meta_value='555'
GROUP BY order_id
The above query correctly selects the order IDs which contain product 555.
Is this safe to do? In other words, will the database structure ever change and break this query?
You could import a CSV file with the help of https://www.woocommerce.com/products/customerorder-xml-export-suite/ or http://www.wpallimport.com/
And yes, I believe you’d still need to generate API key’s / secrets even when it’s sitting on the same server.
I keep getting these emails from this forum even though I closed my problem as resolved. Help! How do I stop it?