Add a button on top of admin orders list in woocommerce

℡╲_俬逩灬. 提交于 2019-12-06 07:37:41

Because this is related to Wordpress and not specific to Woocommerce as Orders are just a custom post type. so the following code will display a custom button on the top zone just after existing fields and buttons:

add_action( 'manage_posts_extra_tablenav', 'admin_order_list_top_bar_button', 20, 1 );
function admin_order_list_top_bar_button( $which ) {
    global $typenow;

    if ( 'shop_order' === $typenow && 'top' === $which ) {
        ?>
        <div class="alignleft actions custom">
            <button type="submit" name="custom_" style="height:32px;" class="button" value=""><?php
                echo __( 'Custom', 'woocommerce' ); ?></button>
        </div>
        <?php
    }
}

Code goes in function.php file of your active child theme (or theme). Tested and works.


Continuation: Run a function on custom button click in woocommerce admin order page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!