Woocommerce Orders
Basic Query for WooCommerce shop_order post type
// WP_Query arguments
$args = array (
'post_type' => 'shop_order',
'post_status' => 'publish',
);
// The Query
$shop_order_post = new WP_Query( $args );
// The Loop
if ( $shop_order_post->have_posts() ) {
while ( $shop_order_post->have_posts() ) {
$shop_order_post->the_post();
// do something
}
} else {
// no posts found
}
// Restore original Post Data
wp_reset_postdata();