Working with post_type => 'shop_order' ?
Closed this issue · 1 comments
taliesinpenbardd commented
Hey, I'm greatly interested in your project, since I have orders from a WooCommerce shop to batch process, but I can't make it work...
When defining the setup()
method, neither $orders = get_posts([ "post_type" => "shop_order" ]);
nor $orders = get_orders();
seem to retrieve anything.
error_log( print_r( $orders ) );
always prints an empty array...
I'm probably doing something wrong, but what? Is there any other info I can give you to help me debug that, if the problem comes from me?
Thanks by advance!
gdarko commented
Hello,
Sorry for my late reply, for woocommerce this should be used.
https://github.com/woocommerce/woocommerce/wiki/wc_get_orders-and-WC_Order_Query#usage