Woocommerce / Wordpress - Add Order Button / Product Page on Admin Panel

I need to add a button and / or text to both the order page and the product page of the woocommerce admin panel. They are actually both types /wp-admin/post.php

, but obviously different types of messages. Is it possible? I go through the available hooks in the woocommerce list and only the ones I have tried actually post the information on the list page of each one.

Just find the filter / hook!

Thanks a lot in advance, sorry for missing code samples - not applicable as just looking for an ID !!

+3


source to share


1 answer


To add a custom button to the Woocommerce order page (on the admin page) you need to use a add_meta_boxes

wordpress action, then we can use a filter to shop_order

show it only on woocommerce orders. So the code will look something like this ...

add_action( 'add_meta_boxes', 'MY_order_meta_boxes' );
function MY_order_meta_boxes()
{
    add_meta_box(
        'woocommerce-order-YOUR-UNIQUE-REF',
        __( 'The title of my box' ),
        'order_meta_box_YOURCONTENT',
        'shop_order',
        'side',
        'default'
    );
}
function order_meta_box_YOURCONTENT()
{
  echo '<button>New button</button>';
}

      



Then you would like your button to do something, so this is adding some JS to this last function too. Then you probably want to use Wordpress AJAX, which you can read about and watch the demo here .

+1


source







All Articles