0

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

0

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 agree to our terms of service, privacy policy and cookie policy

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