• Resolved Holyto

    (@holyto)


    Hi,

    The plugin is very helpful but I’m missing one crucial funcion.

    I need to create a button, which will export a single order with one click (on orders list).
    All I need is to generate the URL with valid _wpnonce from the bulk actions menu.

    Is there a fast way to do it?

    Thanks in advance.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author algol.plus

    (@algolplus)

    hi

    Try following code

    add_filter( 'woocommerce_admin_order_actions', function ( $actions, $order ) {
            $actions['export'] = array(
                'url'       => wp_nonce_url( admin_url( 'admin-ajax.php?action=order_exporter&method=export_download_bulk_file&export_bulk_profile=now&ids=' . $order->get_id() ), 'woocommerce' ),
                'name'      => __( 'Export', 'woocommerce' ),
                'action'    => 'export',
            );
    	return $actions;
    },10,2);
    add_action( 'admin_head',function () {
        echo '<style>.wc-action-button-export::after { font-family: woocommerce !important; content: "\e029" !important; }</style>';
    });

    I use icon e029 , you can set another value ,
    see all icons online https://rawgit.com/woothemes/woocommerce-icons/master/demo.html

    thanks, Alex

    • This reply was modified 6 years, 4 months ago by algol.plus.
    Thread Starter Holyto

    (@holyto)

    Working like a charm! Now the plugin deserves 5-stars. Thank you a lot! ??

    p.s.
    For older WooCommerce use $order->id instead of $order->get_id().

    • This reply was modified 6 years, 4 months ago by Holyto.
    Plugin Author algol.plus

    (@algolplus)

    you’re welcome.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Creating export button for each order on orders list’ is closed to new replies.