2017-10-18 95 views

回答

1

看到你還沒有得到一個答案,我做我自己的自定義一個(其不相同的,absolutelly不最佳,但至少它的作品) 我使用的所有方法是從這裏:https://docs.woocommerce.com/wc-apidocs/class-WC_Order.html

<table class="widefat"> 
           <thead> 
           <tr> 
            <th class="row-title">Ordre-ID</th> 
            <th>Customer ID</th> 
            <th>Name</th> 
            <th>adress</th> 
            <th>note</th> 
            <th>button</th> 
           </tr> 
           </thead> 

           <tbody> 
          <?php 
    global $woocommerce; 
$filters = array(
    'post_status' => 'completed', 
    'post_type' => 'shop_order', 
    'posts_per_page' => 200, 
    'paged' => 1, 
    'orderby' => 'modified', 
    'order' => 'DESC' 
); 


          $loop = new WP_Query($filters); 

          while ($loop->have_posts()) { 
           $loop->the_post(); 
           $order = new WC_Order($loop->post->ID); 
           $items = $order->get_items(); 

            <tr class=""> 
             <td class="row-title"><a href=""><?=$order->get_order_number(); ?></a></td> 
             <td><a href=""><?=$order->get_customer_id(); ?></a></td> 
             <td><?=$order->get_formatted_shipping_full_name(); ?></td> 
             <td><?=$order->get_shipping_address_1(); ?></td> 
             <td><?=$order->get_customer_note(); ?></td> 
             <td><input type="button" class="button" id="order_id-<?=$order->get_order_number();?>" value="Send" data-id="order_id-<?=$order->get_order_number();?>"></td> 
            </tr> 

            <?php 

          } 
          ?> 
         </tbody> 

        </table>