【问题标题】:Get Woocommerce Orders list screen获取 Woocommerce 订单列表屏幕
【发布时间】:2017-10-26 21:14:13
【问题描述】:

我想在我的插件菜单中显示订单屏幕。这样的画面:

Woocommerce Orders Screen

请告诉我如何将此块调用到我的插件菜单中

【问题讨论】:

    标签: wordpress woocommerce


    【解决方案1】:

    看到你没有得到答案,我做了我自己的定制一个(它不完全相同,绝对不是最佳的,但至少它有效) 我使用的所有方法都来自这里: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>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-03-16
      • 2014-05-24
      • 2014-03-07
      • 2022-01-14
      • 2018-10-26
      相关资源
      最近更新 更多