Woo Invoices – option to create invoices for all orders, regardless of payment method/status

May 28, 2018
Sliced Invoices

Currently Woo Invoices creates invoices only when using the “Pay by Invoice’ method, or when an admin sets the order status to “Invoice”. Perhaps add an option to create invoices for all orders, regardless of the above.

2 Comments. Leave new

I also needed this functionality, this method seems to work:

add_action( ‘woocommerce_thankyou’, ‘create_invoice_for_all_orders’, 10, 1 );

function create_invoice_for_all_orders( $order_id ) {
if ( ! $order_id )
return;

$order = wc_get_order( $order_id );
$method = get_post_meta($order_id, ‘_payment_method’, true);

if ( $method != ‘sliced-invoices’ )
sliced_woocommerce_create_quote_or_invoice(‘invoice’, $order);

}

+1 please.

@David Hay; I suppose that leaves the created invoice in Unpaid status?

Leave a Reply

Your email address will not be published.