Currently I am building a plugin which I need to add an action button in order to print a pdf with admin order.


you can use this code to add an action on order edition :

const CUSTOM_ACTION_CODE = "my-plugin__custom-action-code";

add_filter("woocommerce_order_actions", function ($actions) {

    $actions[CUSTOM_ACTION_CODE] = "libel of the custom action";

    return $actions;


add_action("woocommerce_order_action_" . CUSTOM_ACTION_CODE, function (\WC_Order $order) {

    // here the code of the treatement of $order


Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.