在Woocommerce中显示客户订单注释(客户注释) [英] Display Customer order comments (customer note) in Woocommerce
问题描述
当我尝试显示woocommerce客户订单注释(不是注释,而是客户可以在结帐过程中添加的注释)时,我会遇到一些问题.
I have a little problem when I try to display woocommerce customer order comments (not the notes, but the comments that a customer can add during the checkout process).
(我将仅添加此问题的相对行,因为其他woocommerce数据已正确显示,因此不应该是设置问题).
到目前为止,我尝试过的是:
What I've tried so far is this:
$notes = $order->get_customer_order_notes(); //This line returns an Array[]
在该数组内,这是我认为我需要的字段,因为它包含我的订单注释:
Inside that array, this is the field that I think I need, as it contains my order comment:
$notes
0={stdClass} 38
post_excerpt = "test"
所以我所做的就是尝试显示此值:
and so what I did is trying to display this value like this:
echo "Order Notes: " . $notes->post_excerpt
但不幸的是,结果为空.
but unfortunately the result is empty.
我做错了什么? 非常感谢
What am I doing wrong? Many thanks
推荐答案
好吧,经过一段时间的尝试,我终于发现,显示客户结帐注释的正确方法是选择$order->customer_message;
并将此值设置为变量.
Ok, after some time spent on trying, I finally find out that the right way to display the customer checkout comment is selecting $order->customer_message;
and set this value as variable.
这篇关于在Woocommerce中显示客户订单注释(客户注释)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!