title: WooCommerce Get Item Meta from All Orders
body: <p>I am trying to display all Order Items (with the Item Meta) for All completed orders from the WooCommerce plugin. I also want to limit the display to 10 order items only. I have figured out how to display ALL Order Items but cannot limit the number to 10. Here is the code I am currently using to display All Order Items:</p>
  
  <pre><code>$args = array(
                      'post_type' =&gt; 'shop_order',
                      'post_status' =&gt; 'publish',
                      'posts_per_page' =&gt; -1,
                      'tax_query' =&gt; array(
                          array(
                              'taxonomy' =&gt; 'shop_order_status',
                              'field' =&gt; 'slug',
                              'terms' =&gt; array('completed')
                          )
                      )
                  );
  
                  $loop = new WP_Query( $args );
  
                  while ( $loop-&gt;have_posts() ) : $loop-&gt;the_post();
                      $order_id = $loop-&gt;post-&gt;ID;
                      $order = new WC_Order($order_id);
  
                      foreach( $order-&gt;get_items() as $item ) {   
  
                          $date = $item['Booking Date'];
                          $time = $item['Booking Time'];
                          $fname = $item['First Name - First Name'];
                          $church = $item['Church Information - Church Name'];
                          $city = $item['Church Information - City'];
                          $state = $item['Church Information - State'];
                      ?&gt;
  
                          &lt;div class="wc-upcoming-booking"&gt;
                              &lt;div class="wc-upcoming-time"&gt;
                                  &lt;span class="upcoming-hour"&gt;&lt;?php echo $time; ?&gt;&lt;/span&gt;
                                  &lt;span class="upcoming-date"&gt;&lt;?php echo $date; ?&gt;&lt;/span&gt;
                              &lt;/div&gt;
                              &lt;div class="wc-upcoming-details"&gt;
                                  &lt;?php echo $fname . ', ' . $church . ', ' . $city . ', ' . $state; ?&gt;
                              &lt;/div&gt;
                          &lt;/div&gt;
  
                      &lt;?php }
  
                  endwhile;
  </code></pre>
  
  <p>This code queries ALL Completed Orders and then loops through ALL Order Items for each queried Order. Some Orders may have more than 1 Order Item so if I limit the Posts Per Page to 10 and all of those Orders have 5 Order Items than I will have a total of 50 Order Items displayed. I tried adding an "iterate" variable to the foreach loop to limit that but that only loops through the "5" Order Items for one Order and NOT the total "50" Order Items.</p>
  
  <p>First, I need to ORDER all Order Items by the $date and $time variable (which I believe I can do by converting them to a Timestamp using the strtotime() function).</p>
  
  <p>Second, I would like to display to ONLY the first 10 Order Items (based on the timestamp) from All Orders.</p>
  
  <p>Any ideas how to modify this code to allow for this?</p>