I would like to get the list of the orders, with the “shop_order” post type.
Either on orders page or on a custom admin page. All this would help me to filter them by date, location and total order weight.

I have tried the below code:

global $post, $woocommerce, $the_order;
  $args = array(
   'post_type' => 'shop_order',
   'post_status' => 'publish',
   'meta_key' => '_customer_user',
   'posts_per_page' => '-1'
   );
  $my_query = new WP_Query($args);
  $customer_orders = $my_query->posts;
  foreach ($customer_orders as $customer_order) {
   $order = new WC_Order();
   $order->get_shipping_methods();
   $orderdata = (array) $order;
   print_r($orderdata);
  }

I can’t figure out what I am missing.

Read more here: Get list of ‘shop_order’ post type


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Related Wordpress search:

, , ,

Wordpress related questions and answers: