viiskis
viiskis

Reputation: 164

Add a new block to Woocommerce admin order page

I want to create a custom table block in Woocommerce admin order page. As you can see in a screenshot, I have used :

add_action( 'woocommerce_admin_order_data_after_order_details', 'vp_admin_order_table' );

What I want is to create a separate block, with this table inside it.

Is there any action to trigger gap between Order details and Products list?

enter image description here

Upvotes: 4

Views: 1220

Answers (1)

Incinerator
Incinerator

Reputation: 2817

Try this code:

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>';
}

Remember to set to box as visible under "Screen Options" on the order page.


Further reading:

Upvotes: 2

Related Questions