I am wanting to skip the invoice for my cancelled & failed order. I am using the WooCommerce PDF Invoice plugin. It is very simple and easy job. Plugin have a filter bewpi_skip_invoice_generation. So you can do it without editing the core plugin.
1 2 3 4 5 6 7 8 9 10 11 |
function cpaul_skip_invoice_generation( $bool, $status, $order ) { /** * wc-failed slug is for Failed order * wc-cancelled slug is for Cancelled order */ if( $status == "wc-failed" || $status == 'wc-cancelled' ) return true; // true to skip return bool; } add_filter( 'bewpi_skip_invoice_generation', 'cpaul_skip_invoice_generation', 10, 3 ); |
Just drop the above code into your functions.php file or custom… Continue Reading