Including PDF into WooCommerce email only when payment method is BACS
-
Hello!
Last time I wrote on this forum, I found, that I had this code snippet in my functions as a comment, but I didn’t know why I disabled it. The code below works, and it only sends the PDF invoice to customers that use direct bank transfer as their form of payment, however, the code messes up my WooCommerce Orders page. I can’t access the screen options tab in WooCommerce Orders, AND I am only being shown 1 order for some reason. All other orders are hidden. It’s not a cache problem, it’s not a cookies problem, as I also tried, if WooCommerce orders are shown on my phone, but they are not.
I went ahead and started disabling parts of code, and found that the code below is the reason for this happening.
/* PDF Invoice for BACS only */ add_filter( 'wpo_wcpdf_document_is_allowed', function ( $allowed, $document ) { if ( $order = $document->order && $document->type == 'invoice') { // Set the payment method IDs below $payment_methods = ['bacs']; $allowed = ( in_array( $order->get_payment_method(), $payment_methods ) ) ? true : false; } return $allowed; }, 10, 2 );
Is there another way of getting the code’s function into my website, or any other way I can fix this problem?
Kind regards
The page I need help with: [log in to see the link]
- The topic ‘Including PDF into WooCommerce email only when payment method is BACS’ is closed to new replies.