Hi @harrythakur,
You will achieve it with the following code snippet that I just wrote for you:
/**
* PDF Invoices & Packing Slips for WooCommerce:
* Skip the PDF Invoice attachment if the payment method is "Cash on delivery" (cod)
*/
add_filter( 'wpo_wcpdf_custom_attachment_condition', function( $condition, $order, $email_id, $document_type ) {
if ( ! empty( $order ) && 'invoice' == $document_type ) {
$payment_method = is_callable( array( $order, 'get_payment_method' ) ) ? $order->get_payment_method() : '';
if ( 'cod' == $payment_method ) {
$condition = false;
}
}
return $condition;
}, 10, 4 );
If you haven’t worked with code snippets (actions/filters) or functions.php
before, read this guide: How to use code snippets