[英]Woocommerce update order_comments after placed order
下訂單時,需要將自定義字段附加到訂單注釋中。 我可以使用來更新公司並將號碼附加到末尾
update_post_meta( $order_id, '_billing_company', $_companyName );
在admin的“訂單詳細信息”頁面上,“運輸詳細信息”下的字段稱為
在結帳頁面上,“客戶提供的便箋”稱為“ order_comments”。
在訂單詳細信息頁面上,它被稱為“摘錄”以及“ post_excerpt”。 如果我使用update_post_meta( $order_id, 'post_excerpt', $_urn );
該字段未更新。 我也嘗試了摘錄和order_comments,但無法更新此字段。
有任何想法嗎?
“客戶提供的便箋”作為post_excerpt
存儲在支持post_excerpt
的order
WC_Order
。 要對其進行更新,您可以使用標准的WordPress Codex或wc_update_order()
函數(實際上是WordPress Codex的前端,但可能是正確的方法)。
// specify the order_id so WooCommerce knows which to update
$order_data = array(
'order_id' => $order_id,
'customer_note' => 'The customer note.'
);
// update the customer_note on the order
wc_update_order( $order_data );
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.