Title: Disable invoice by payment method
Last modified: December 30, 2016

---

# Disable invoice by payment method

 *  Resolved [francescor](https://wordpress.org/support/users/francescor/)
 * (@francescor)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/disable-invoice-by-payment-method/)
 * Hi, is it possible to disable the invoice generation if a specific payment method
   is used?
 * Thanks
    -  This topic was modified 9 years, 4 months ago by [francescor](https://wordpress.org/support/users/francescor/).

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

 *  Plugin Contributor [Ewout](https://wordpress.org/support/users/pomegranate/)
 * (@pomegranate)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/disable-invoice-by-payment-method/#post-8609874)
 * Hi! Yes, you can use a filter for that:
 *     ```
       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 == 'cheque' ) {
       		return false;
       	} else {
       		return $condition;
       	}
       }
       ```
   
 * Read this if you haven’t worked with code snippets/filters like this before: 
   [How to use filters](http://docs.wpovernight.com/general/how-to-use-filters/).
 * Hope that helps!
    Ewout
 *  Thread Starter [francescor](https://wordpress.org/support/users/francescor/)
 * (@francescor)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/disable-invoice-by-payment-method/#post-8610214)
 * Thank you, I tried the script. The invoice does not get sent to the user via 
   mail but it still gets generated and it is downloadable by the user from his 
   control panel, so the problem did not get solved.
 * Moreover – but I might need to open another thread for this – sometimes the invoices
   get generated in hungarian (while they should be in italian).
 * Could you please help?
 * Thanks
 * Francesco
 *  Plugin Contributor [Ewout](https://wordpress.org/support/users/pomegranate/)
 * (@pomegranate)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/disable-invoice-by-payment-method/#post-8614053)
 * Hi francesco,
    You can control the visibility of the invoice button in the General
   settings tab.
 * Are you using WPML or Polylang? If so, you need the [Professional extension](https://wpovernight.com/downloads/woocommerce-pdf-invoices-packing-slips-professional/)
   for full multilingual support (other multilingual plugins are not currently supported).
 * Ewout
    -  This reply was modified 9 years, 4 months ago by [Ewout](https://wordpress.org/support/users/pomegranate/).
 *  Thread Starter [francescor](https://wordpress.org/support/users/francescor/)
 * (@francescor)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/disable-invoice-by-payment-method/#post-8616854)
 * The invoice has not to be generated if a specific payment method is used. Is 
   this possibile? If it gets generated there will be a document with a progressive
   number that we will have to account for in some way and that won’t work for us.
 * I am not using any multi-language plugin at the moment. To be precise WPML is
   installed but not active. Anyway the invoices must be in the default language
   for now (that is not hungarian).
 * Please let me know
 * Thanks
 * Francesco
 *  Plugin Contributor [Ewout](https://wordpress.org/support/users/pomegranate/)
 * (@pomegranate)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/disable-invoice-by-payment-method/#post-8622006)
 * Hi Francesco,
    Yes, that’s certainly possible with the above script. Just make
   sure you have configured the plugin so that the user can only see the download
   link in My Account if an invoice was already created. Note that the admin (=shop
   manager) buttons will still be visible!
 * I have no explanation for why the invoices are in hungarian, although with WP4.7
   it is possible to change the language of the admin per user, and this also changes
   the language of the invoice. I cannot do anything about this.
 * If you are considering WPML, I recommend looking at Polylang too. Polylang is
   much more stable in my experience and also ‘speaks WPML’, which means that most
   plugins that are WPML compatible are also Polylang compatible.
 * Good luck!
    Ewout
 *  Thread Starter [francescor](https://wordpress.org/support/users/francescor/)
 * (@francescor)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/disable-invoice-by-payment-method/#post-8884568)
 * It works, thanks. The buttons that generate the invoices were misleading me. 
   I simply hid them now. I did not understand that they actually generate invoices
   that do not exist at all.
 *  Plugin Contributor [Ewout](https://wordpress.org/support/users/pomegranate/)
 * (@pomegranate)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/disable-invoice-by-payment-method/#post-8888787)
 * Great, glad to hear that’s resolved!
 * Ewout

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

The topic ‘Disable invoice by 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

 * [disable attachment](https://wordpress.org/support/topic-tag/disable-attachment/)
 * [payment method](https://wordpress.org/support/topic-tag/payment-method/)

 * 7 replies
 * 2 participants
 * Last reply from: [Ewout](https://wordpress.org/support/users/pomegranate/)
 * Last activity: [9 years, 2 months ago](https://wordpress.org/support/topic/disable-invoice-by-payment-method/#post-8888787)
 * Status: resolved