How to add custom fields for WooCommerce order page (admin)?
I would like to add some input fields for orders in WooCommerce / Wordpress. The fields will only be visible on the admin page. How to do it? Does it look like pages / posts?
For the post types above, I used add_post_meta strong>. Is this the best way to do this, or is there any kind of hook for order fields?
0
source to share
1 answer
Yes, just add_meta_box()
for the message type shop_order
and continue as usual .
add_action( 'add_meta_boxes', 'add_meta_boxes' );
function add_meta_boxes()
{
add_meta_box(
'woocommerce-order-my-custom',
__( 'Order Custom' ),
'order_my_custom',
'shop_order',
'side',
'default'
);
}
function order_my_custom()
{
echo '<h1>Sample meta box</h1>';
}
+9
source to share