Sending the PDF Invoice for only 2 payment methods
-
Hey!
I have 4 payment options on my site – Cash on delivery, Bank transfer, PayPal and Credit card (Stripe). The thing is, that I only want to send the PDF to cash on delivery and bank transfer options.
I’ve searched for the solution myself already and I’ve found this code by @kluver :
// exclude certain payment methods from automatic pdf creation add_filter( 'wpo_wcpdf_custom_attachment_condition', 'wpo_wcpdf_exclude_payment_method', 100, 4 ); function wpo_wcpdf_exclude_payment_method ( $condition, $order, $status, $document ) { $excluded_methods = array( 'stripe', 'bacs' ); $payment_method = get_post_meta( $order->id, '_payment_method', true ); if ( $document == 'invoice' && in_array( $payment_method, $excluded_methods ) ) { return false; } else { return $condition; } }
The thing is – I’m average with css, however, functions.php are way out of my league. I know I need to add them to the excluded_methods array, but I don’t know how to target them.
Kind regards
The page I need help with: [log in to see the link]
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Sending the PDF Invoice for only 2 payment methods’ is closed to new replies.