Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/253.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 在Woocommerce中显示客户订单注释(客户注释)_Php_Wordpress_Woocommerce_Message_Orders - Fatal编程技术网

Php 在Woocommerce中显示客户订单注释(客户注释)

Php 在Woocommerce中显示客户订单注释(客户注释),php,wordpress,woocommerce,message,orders,Php,Wordpress,Woocommerce,Message,Orders,当我试图显示woocommerce客户订单注释(不是注释,而是客户在结账过程中可以添加的注释)时,我遇到了一个小问题 (由于其他woocommerce数据显示正确,因此不应出现设置问题,因此我将仅添加此问题的相关行)。 到目前为止,我尝试的是: $notes = $order->get_customer_order_notes(); //This line returns an Array[] 在该数组中,这是我认为需要的字段,因为它包含我的订单注释: $notes 0={stdCl

当我试图显示woocommerce客户订单注释(不是注释,而是客户在结账过程中可以添加的注释)时,我遇到了一个小问题

(由于其他woocommerce数据显示正确,因此不应出现设置问题,因此我将仅添加此问题的相关行)。

到目前为止,我尝试的是:

$notes = $order->get_customer_order_notes(); //This line returns an Array[]
在该数组中,这是我认为需要的字段,因为它包含我的订单注释:

$notes
  0={stdClass} 38
    post_excerpt = "test"
因此,我所做的是尝试如下显示此值:

echo "Order Notes: " . $notes->post_excerpt
但不幸的是,结果是空的

我做错了什么?
非常感谢

好的,经过一段时间的尝试,我终于发现显示客户结帐评论的正确方法是选择
$order->customer\u message
并将此值设置为变量

更新2017-2018 |适用于Woocommerce 3+

由于Woocommerce 3,您无法从
WC\u Order
对象访问更多属性。您需要改用
WC\u Order
方法:

相关:


谢谢!!这有助于我定制YITH Woocmerce PDF发票和发货清单插件模板的输出,以适应客户注释。。。作为任何相关方的参考,对于该插件而言,适当的调整变量值为$document->order->customer\u message;
$customer_note = $order->get_customer_note();