The site is fully HPOS.
I'm writing a standalone code outside WP/Woo to update a custom order meta field (in wp_wc_orders_meta) for thousands of orders. It'll run once, so it's outside Woo/WP and won't use hooks, filters, or the item object.
The order ids and respective order item ids are known for the orders that need the data updated.
I need to get the order item product id and can't find it in the HPOS order tables. It's in HPOS incompatible tables, wp_woocommerce_order_itemmeta and wp_wc_order_product_lookup (Recent order items are not in those tables.).
I could get wp_woocommerce_order_items > order_item_name and look for that in wp_posts > post_title, but the name may have changed since the order was placed and would not return the correct result if at all.
Are the HPOS-compatible tables where I can trace to get the product id for the order items?
I found it. We had the WP/Woo cron disabled and enabled the cron in our server less often (There were many server spikes since some WP/Woo cron runs with every page load.). After enabling it again to run through WP/Woo and going to the order edit page, it will then save to the table. sigh.
If the spikes return, we'll need to figure out how to get this table working with the WP/Woo crons running on our server.