Title: Excluding payment method not working
Last modified: March 5, 2020

---

# Excluding payment method not working

 *  [Sigurd Heggemsnes](https://wordpress.org/support/users/heggemsnes/)
 * (@heggemsnes)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/excluding-payment-method-not-working/)
 * Hi
 * I’m using this code
 *     ```
       // Exclude invoice when chosen faktura
       function exclude_payments($payment_methods)
       {
   
           return array('klarna','cheque');
       }
       add_filter('bewpi_attach_invoice_excluded_payment_methods', 'exclude_payments', 10, 2);
       ```
   
 * Order looks like this in database: [https://imgur.com/a/Nev6h3k](https://imgur.com/a/Nev6h3k)
 * I’m using a custom invoice template.
 * No relevant errors in error_log. Rest of the plugin working fine.
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fexcluding-payment-method-not-working%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [Bas Elbers](https://wordpress.org/support/users/baaaaas/)
 * (@baaaaas)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/excluding-payment-method-not-working/#post-12528184)
 * Hi Sigurd,
 * So you want to make sure that no invoice will be added to the email when using
   klarna or cheque payment method has been used?
 * So in this situation our plugin did attach a PDF invoice to order number 1227?
 * Did you’ve added the filter function to your (child) themes functions.php file?
 *  Thread Starter [Sigurd Heggemsnes](https://wordpress.org/support/users/heggemsnes/)
 * (@heggemsnes)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/excluding-payment-method-not-working/#post-12529006)
 * Yes, yes and yes.
 *  Plugin Author [Bas Elbers](https://wordpress.org/support/users/baaaaas/)
 * (@baaaaas)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/excluding-payment-method-not-working/#post-12531956)
 * In order for us to resolve this issue we will need more information. Please check
   the [first topic](https://wordpress.org/support/topic/readme-first-7/).

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Excluding payment method not working’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce-pdf-invoices/assets/icon-128x128.png?rev=1128583)
 * [Invoices for WooCommerce](https://wordpress.org/plugins/woocommerce-pdf-invoices/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce-pdf-invoices/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce-pdf-invoices/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce-pdf-invoices/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce-pdf-invoices/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce-pdf-invoices/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Bas Elbers](https://wordpress.org/support/users/baaaaas/)
 * Last activity: [6 years, 3 months ago](https://wordpress.org/support/topic/excluding-payment-method-not-working/#post-12531956)
 * Status: not resolved