wordpress - Woocommerce 订单列表中的私人笔记
问题描述
我们在私人笔记中添加我们自己的生产编号,如果我们可以在新列下的订单列表中显示这些私人笔记,那将非常方便,在互联网上搜索但没有一个代码有效。
非常感谢!
解决方案
尝试在 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 ) ) ) ) );
}
}
}
推荐阅读
- android - 有没有办法在颤动中快进和快退音频?
- dependencies - 如何解决引起:org.springframework.beans.factory.UnsatisfiedDependencyException:?
- python-3.x - 在 Python ConfigPraser 模块中解析两个配置文件中的值
- batch-file - 切换到部分时发生崩溃
- arrays - Json读取并转换为数据框
- excel - VBA 中的默认日期格式设置
- php - Laravel Modal不断删除数据库中的最后一个id
- javascript - 为什么 Jquery offset() 在多次点击时触发多次
- ruby-on-rails - 如何增加 rails admin gem 中投递箱的限制
- unity3d - 为什么我在 HoloLens 中的 3d 对象一直跟着我并且不稳定?