title: Display items in order including image WooCommerce
body: <p>I am trying to display the products/items within a WooCommerce order using the following php, but the items are not being shown.</p>
  
  <p>The code I am using is an adaptation of this: <a href="https://stackoverflow.com/questions/28576667/get-cart-item-name-quantity-all-details-woocommerce/28576861">Get cart item name, quantity all details woocommerce</a></p>
  
  <p>Using the original code from the question above also does not display anything on my page.</p>
  
  <p>Thanks in advance.</p>
  
  <pre><code>&lt;?php  
  
  
          global $woocommerce;
          $items = $woocommerce-&gt;cart-&gt;get_cart();
  
          foreach($items as $item =&gt; $values) { 
          $_product = $values['data']-&gt;post;
          //product image
          $getProductDetail = wc_get_product( $values['product_id'] );
          echo '&lt;tr&gt;&lt;td&gt;';
          echo $getProductDetail-&gt;get_image(); // accepts 2 arguments ( size, attr )
          echo '&lt;/td&gt;';
          echo '&lt;td&gt;';
          echo '&lt;p style="font-size:10pt;"&gt;'.$_product-&gt;post_title.'&lt;/p&gt;&lt;td&gt;&lt;p style="font-size:10pt;"&gt;x'. $values['quantity'] . '&lt;/p&gt;&lt;/td&gt;'; 
          echo '&lt;/td&gt;&lt;/tr&gt;';
          };
     ?&gt;
  </code></pre>
  
  <p>The full page code is here:</p>
  
  <pre><code>&lt;?php
  /*
  Template Name: Store
  */
  if (!is_user_logged_in() || !current_user_can('manage_options')) wp_die('This page is private.');
  
  
  ?&gt;
    &lt;!DOCTYPE HTML&gt;
    &lt;html&gt;
  
    &lt;head&gt;
      &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js"&gt;&lt;/script&gt;
      &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt;
      &lt;title&gt;
        &lt;?php _e('Store Queue'); ?&gt;
      &lt;/title&gt;
  
    &lt;/head&gt;
  
    &lt;body id="driverqueue"&gt;
      &lt;header&gt;
        &lt;?php if (have_posts()) : while (have_posts()) : the_post(); ?&gt;
  
          &lt;h1 class="title"&gt;&lt;?php the_title(); ?&gt;&lt;/h1&gt;
  
          &lt;?php the_content(); ?&gt;
  
            &lt;?php endwhile; endif; ?&gt;
      &lt;/header&gt;
      &lt;section&gt;
        &lt;?php 
  
    global $woocommerce;
  
  
    $args = array(
      'post_type' =&gt; 'shop_order',
      'post_status' =&gt; 'wc-processing',
      'meta_key' =&gt; '_customer_user',
      'posts_per_page' =&gt; '-1'
    );
    $my_query = new WP_Query($args);
  
    $customer_orders = $my_query-&gt;posts;
  
    foreach ($customer_orders as $customer_order) {
     $order = new WC_Order();
  
     $order-&gt;populate($customer_order);
     $orderdata = (array) $order;
  
     // $orderdata Array will have Information. for e.g Shippin firstname, Lastname, Address ... and MUCH more.... Just enjoy!
    }
  
  
  
  
    $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);
  
      ?&gt;
  
  
  
  
  
  
  
          &lt;table class="ordertable" id="&lt;?php echo $order_id; ?&gt;"&gt;
            &lt;tr&gt;
              &lt;td&gt;
                &lt;p&gt;Order #
                  &lt;?php echo $order_id; ?&gt; &amp;mdash;
                    &lt;time datetime="&lt;?php the_time('c'); ?&gt;"&gt;
                      &lt;?php echo the_time('d/m/Y g:i:s A'); ?&gt;
                    &lt;/time&gt;
                &lt;/p&gt;
              &lt;/td&gt;
              &lt;td&gt;
                &lt;?php echo $order-&gt;billing_first_name . ' ' . $order-&gt;billing_last_name ?&gt;
              &lt;/td&gt;
              &lt;td&gt;
                &lt;table&gt;
                  &lt;tr&gt;
  
                    &lt;?php  
  
  
              global $woocommerce;
              $items = $woocommerce-&gt;cart-&gt;get_cart();
  
              foreach($items as $item =&gt; $values) { 
              $_product = $values['data']-&gt;post;
              //product image
              $getProductDetail = wc_get_product( $values['product_id'] );
              echo '&lt;tr&gt;&lt;td&gt;';
              echo $getProductDetail-&gt;get_image(); // accepts 2 arguments ( size, attr )
              echo '&lt;/td&gt;';
              echo '&lt;td&gt;';
              echo '&lt;p style="font-size:10pt;"&gt;'.$_product-&gt;post_title.'&lt;/p&gt;&lt;td&gt;&lt;p style="font-size:10pt;"&gt;x'. $values['quantity'] . '&lt;/p&gt;&lt;/td&gt;'; 
              echo '&lt;/td&gt;&lt;/tr&gt;';
              };
                ?&gt;
                  &lt;/tr&gt;
                &lt;/table&gt;
              &lt;/td&gt;
              &lt;td&gt;
                &lt;p&gt;
                  &lt;?php
              do_action( 'woocommerce_admin_order_actions_start', $order );
  
              $actions = array();
  
  
              if ( $order-&gt;has_status( array( 'pending', 'on-hold', 'processing' ) ) ) {
                $actions['complete'] = array(
                  'url'       =&gt; wp_nonce_url( admin_url( 'admin-ajax.php?action=woocommerce_mark_order_status&amp;status=awaiting-shipment&amp;order_id=' . $post-&gt;ID ), 'woocommerce-mark-order-status' ),
                  'name'      =&gt; __( 'Complete', 'woocommerce' ),
                  'action'    =&gt; "complete"
                );
              };
  
              $actions = apply_filters( 'woocommerce_admin_order_actions', $actions, $order );
  
              foreach ( $actions as $action ) {
                printf( '&lt;a class="button %s" href="%s" data-tip="%s"&gt;%s&lt;/a&gt;', esc_attr( $action['action'] ), esc_url( $action['url'] ), esc_attr( $action['name'] ), esc_attr( $action['name'] ) );
              }
  
              do_action( 'woocommerce_admin_order_actions_end', $order );
            ?&gt;
                &lt;/p&gt;
              &lt;/td&gt;
              &lt;td&gt;
                &lt;form action=""&gt;
                  &lt;input type="checkbox" class="ordercollected" value="0" /&gt;
                &lt;/form&gt;
              &lt;/td&gt;
            &lt;/tr&gt;
            &lt;?php endwhile; ?&gt;
  
      &lt;/section&gt;
    &lt;/body&gt;
  
    &lt;/html&gt;
  </code></pre>