我想在Woocommerce管理订单页面中创建自定义表格块。 正如您在屏幕截图中所看到的,我已经使用过:
add_action( 'woocommerce_admin_order_data_after_order_details', 'vp_admin_order_table' );
我想要的是创建一个单独的块,并在其中包含此表。
是否有任何措施触发订单明细和产品列表之间的空白?
答案 0 :(得分:1)
尝试以下代码:
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>';
}
记住要设置为在订单页面上“屏幕选项”下可见的框。
进一步阅读: