It would be great to query woocommerce orders and downloads stored as HPOS on the query loop.
When HPOS is active on WooCommerce, orders and downloads are stored on _woo_orders _woo_orders_meta _woo_downloads _woo_downloads_meta tables, for higher database performance. As they are gone of _posts and post_meta tables, those entries are not reachable by the Bricks query loop.
Supporting HPOS will allow to highly customise the woocommerce customer endpoints while keeping high performance.
Meanwhile we are using wc_get_orders to customize the Woocommerce Order endpoint template.
if someone is still interested, i got it working with the new API Query available since Bricks 2.1.
Of couse the usual dynamic data tags won´t work, but creating custom dynamic data from the api-query is pretty simple in bricks.
I use my own Rest-Endpoint but i guess it will work with the Woocommerce API as well.
I prepared months ago a “My purchased Videos” page template for customers to play their purchased downloadable media online (videos) without downloading. I did with pure PHP while supporting HPOS, including search a purchased product among the customer orders, sort and pagination. I wanted to do that with Bricks using the query loop, but finaly I had to write the template with pure PHP which was really complex to me, but thanks to IA I achieved that succesfully.
For each order I had to get the download links, then the download retries count and expiration date, the protected file link using X-send and send it to a html < video > tag, also with the product name, and video cover, video duration and other ACF fields per product and order.
Not sure if I will achieve such page with API queries inside query lloops on Bricks.
Nice,“Woo Orders Query” type doesn’t appears on <= 2.2 beta. Is this expected for future versions? Or is a hack you did? Or I’m missing something?
Also, customers would love to use a “product search” among orders, by typing the name of the product and the query returns the customer orders containing that given product, like Amazon does. Would this be possible?