How do I skip invoice generation based on a payment method?

In order to skip invoice generation based on a payment method, simply add the following action to your themes  functions.php

function bewpi_attach_invoice_excluded_payment_methods( $payment_methods ) {
    return array( 'bacs', 'cod', 'cheque', 'paypal' );
}
add_filter( 'bewpi_attach_invoice_excluded_payment_methods', 'bewpi_attach_invoice_excluded_payment_methods', 10, 2 );

Add the name of the payment method in the return array section. This is the second line.


Please test the functionality on a development environment of your website. If it ceases to work, please revert back to the original state of your website and follow the tutorial again.