php - WooCommerce - 如何将列添加到管理订单页面中的产品列表

标签 php wordpress woocommerce product orders

我正在尝试将列产品列表添加到管理订单页面。
就像图片上的东西:

最佳答案

当前版本的 WooCommerce,没有简单的方法。

这是负责该部分的代码。

    <tbody id="order_line_items">
    <?php
        foreach ( $line_items as $item_id => $item ) {
            do_action( 'woocommerce_before_order_item_' . $item->get_type() . '_html', $item_id, $item, $order );

            include( 'html-order-item.php' );

            do_action( 'woocommerce_order_item_' . $item->get_type() . '_html', $item_id, $item, $order );
        }
        do_action( 'woocommerce_admin_order_items_after_line_items', $order->get_id() );
    ?>
    </tbody>

特别是这一行:include('html-order-item.php');。 如果您查看 html-order-item.php 的内容,您会发现没有任何钩子(Hook)可以让您添加另一个 td

我可以建议你在 foreach 循环中使用上面的两个操作之一。使用它来将 td 标记与您的数据一起放置。 然后使用 jQuery 将 td 传输到它应该在的位置。

关于php - WooCommerce - 如何将列添加到管理订单页面中的产品列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49505736/

相关文章:

PHPMailer 发送双重电子邮件

javascript - WordPress Revolution slider : Unmuting failed and the element was paused instead because the user didn't interact with the document before

wordpress - Cloudflare 阻止来自 Wordpress 部署的混合内容

html - 带有 w3css 框架的 Wordpress 导航

php - 允许客户更改 WooCommerce 我的帐户中的订单状态

javascript - php:修改html标签的属性

php - 从php中的数组中获取值的索引

php - 登录时验证用户并授予他们有限的数据库权限

php - WooCommerce:检查优惠券是否有效

Paypal 沙箱总是返回空白页?