Woocommerce订单列表中的私人注释

时间:2019-11-26 10:14:14

标签: wordpress woocommerce

我们将自己的生产编号添加到私人注释中,如果我们可以在订单列中的新列下显示这些私人注释,这在整个互联网上进行搜索但没有任何代码有效,那将非常方便。

非常感谢!

1 个答案:

答案 0 :(得分:0)

尝试在function.php文件中添加以下代码段:

add_action( 'wpo_wcol_custom_row', 'wpo_wcol_order_notes', 10, 1 );
function wpo_wcol_order_notes ( $order_id ) {
    $notes = wc_get_order_notes( array(
        'order_id' => $order_id,
        'type'     => 'customer', // use 'internal' for admin and system notes, empty for all
    ) );

    if ( $notes ) {
        foreach( $notes as $key => $note ) {
            // system notes can be identified by $note->added_by == 'system'
            printf( '<div class="note_content">%s</div>', wpautop( wptexturize( wp_kses_post( make_clickable( $note->content ) ) ) ) );
        }
    }
}