Title: Exclude from payment method
Last modified: August 22, 2016

---

# Exclude from payment method

 *  Resolved [TeamCreative](https://wordpress.org/support/users/teamcreative/)
 * (@teamcreative)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/exclude-from-payment-method/)
 * Hello,
 * Has anyone tried to exclude a certain payment method from attaching a pdf?
    I
   tried everything but can;t get it right. Seen like i can’t unset PDF from sending.(
   $order->payment_method)
 * Thnks in advance!
 * [https://wordpress.org/plugins/woocommerce-pdf-invoices-packing-slips/](https://wordpress.org/plugins/woocommerce-pdf-invoices-packing-slips/)

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

 *  Plugin Contributor [Ewout](https://wordpress.org/support/users/pomegranate/)
 * (@pomegranate)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/exclude-from-payment-method/#post-5556847)
 * Hi There,
    You can use the `wpo_wcpdf_custom_attachment_condition` filter for
   any rules you want to apply to automatic pdf invoice attachment.
 *     ```
       // 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 ) {
       	$payment_method = get_post_meta( $order->id, '_payment_method', true );
       	if ( $payment_method == 'your_payment_method' ) {
       		return false;
       	} else {
       		return $condition;
       	}
       }
       ```
   
 * Hope that helps!
    Ewout
 *  Thread Starter [TeamCreative](https://wordpress.org/support/users/teamcreative/)
 * (@teamcreative)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/exclude-from-payment-method/#post-5556851)
 * Wow! Helped me out, Thnks!!
 *  [SimWeb1982](https://wordpress.org/support/users/simweb1982/)
 * (@simweb1982)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/exclude-from-payment-method/#post-5557181)
 * Hello
 * My programming skills are limited. Where do I have to put this code? I would 
   appreciate if you can tell me that Step-by-Step.
 * Thanks…
 *  Plugin Contributor [Ewout](https://wordpress.org/support/users/pomegranate/)
 * (@pomegranate)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/exclude-from-payment-method/#post-5557182)
 * Hello SimWeb,
    This code should be placed in your theme’s functions.php or Custom
   Functions (some themes have a settings area for this). Your theme author should
   be able to help with this if necessary. After you have found functions.php, don’t
   forget to replace ‘your_payment_method’ in the code with the name/slug of the
   payment method that you want to exclude from invoicing.
 * Ewout.

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

The topic ‘Exclude from payment method’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce-pdf-invoices-packing-slips/assets/icon-256x256.
   png?rev=2189942)
 * [PDF Invoices & Packing Slips for WooCommerce](https://wordpress.org/plugins/woocommerce-pdf-invoices-packing-slips/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce-pdf-invoices-packing-slips/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce-pdf-invoices-packing-slips/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce-pdf-invoices-packing-slips/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce-pdf-invoices-packing-slips/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce-pdf-invoices-packing-slips/reviews/)

## Tags

 * [Wordpress Woocommerce](https://wordpress.org/support/topic-tag/wordpress-woocommerce/)

 * 4 replies
 * 3 participants
 * Last reply from: [Ewout](https://wordpress.org/support/users/pomegranate/)
 * Last activity: [11 years, 4 months ago](https://wordpress.org/support/topic/exclude-from-payment-method/#post-5557182)
 * Status: resolved