問題描述
以下 僅在 WooCommerce Admin 單個訂單中顯示產品自定義字段 對我上一個問題的回答,其中:
Following Display a product custom field only in WooCommerce Admin single orders answer to my previous question, which:
- 添加自定義 SKU 字段(文章 ID)
- 將自定義 SKU(ArticleID)保存為隱藏訂單項元數據
- 將自定義 SKU(商品 ID)保存為手動訂單的隱藏訂單項元數據
如何更改管理單訂單頁面的訂單行項目部分顯示的元鍵標簽 _articleid
?
How can I change the displayed meta key label _articleid
on order line items section of the admin single order pages?
現在它顯示SKU",即變體 ID"(用于產品變體)和_articleid".
Right now it shows the "SKU", the "Variation ID" (for product variations) and the "_articleid".
我想替換顯示的_articleid"帶有文章 ID"相反.
I'd like to replace displayed "_articleid" with "Article ID" instead.
有什么幫助嗎?
推薦答案
您將使用以下內容將顯示的鍵標簽 _articleid
替換為例如 WooCommerce 管理單訂單上的訂單項中的文章 ID":
You will use the following to replace displayed key label _articleid
with for example 'Article ID' in order items on WooCommerce admin single orders:
add_filter('woocommerce_order_item_display_meta_key', 'filter_wc_order_item_display_meta_key', 20, 3 );
function filter_wc_order_item_display_meta_key( $display_key, $meta, $item ) {
// Change displayed label for specific order item meta key
if( is_admin() && $item->get_type() === 'line_item' && $meta->key === '_articleid' ) {
$display_key = __("Article ID", "woocommerce" );
}
return $display_key;
}
代碼位于活動子主題(或活動主題)的functions.php 文件中.它應該有效.
Code goes in functions.php file of the active child theme (or active theme). It should works.
相關:
更改訂單項WooCommerce 管理訂單中的自定義元數據顯示標簽和值
與此線程相關:
- 如何展示產品WooCommerce 訂單中的自定義字段(自定義 SKU)
- 顯示產品自定義字段僅在手動訂單的 WooCommerce 管理單個訂單中
這篇關于更改訂單項在 WooCommerce 管理訂單頁面中顯示的元鍵標簽的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!