wordpress - 向 Woocommerce 管理订单页面添加新块
问题描述
我想在 Woocommerce 管理订单页面中创建一个自定义表格块。正如您在屏幕截图中看到的那样,我使用了:
add_action( 'woocommerce_admin_order_data_after_order_details', 'vp_admin_order_table' );
我想要的是创建一个单独的块,里面有这个表。
是否有任何操作可以触发订单详细信息和产品列表之间的差距?
解决方案
试试这个代码:
function op_register_menu_meta_box() {
add_meta_box(
'Some identifier of your custom box',
esc_html__( 'Box Title', 'text-domain' ),
'render_meta_box',
'shop_order', // shop_order is the post type of the admin order page
'normal', // change to 'side' to move box to side column
'low' // priority (where on page to put the box)
);
}
add_action( 'add_meta_boxes', 'op_register_menu_meta_box' );
function render_meta_box() {
// Metabox content
echo '<strong>Your awesome content goes here</strong>';
}
请记住在订单页面的“屏幕选项”下将框设置为可见。
进一步阅读:
推荐阅读
- powershell - 尝试使用“指定的网络资源或设备不再可用”读取证书存储时,PowerShell 失败
- typescript - 将打字稿中索引器的键限制为仅来自联合的 1 个值
- php - 如何在脚本中找到所有提到的带有数字的 CVV,然后用 * 替换数字。在 PHP 中使用正则表达式
- string - Vector3.ToString 构建后“四舍五入”小数
- javascript - Express.js 服务器突然无法工作 - 无法获取 /
- r - 用于直接引用变量而不是 R 中的 dataset$variable 的函数
- bash - 如何访问 HTTP WWW-Authenticate:基本输入作为 CGI 文件中的变量
- java - isDisplayed() 方法执行时间太长
- html - 网格内有溢出空白的 HTML 文本
- gnuplot - Gnu 绘图填充不完整并留下残留的锯齿状伪影