Title: disable button create
Last modified: May 24, 2018

---

# disable button create

 *  Resolved [Andrea](https://wordpress.org/support/users/licoreo/)
 * (@licoreo)
 * [8 years ago](https://wordpress.org/support/topic/disable-button-create/)
 * Hello,
    I am using this plugin and it works very well, but I have a problem with
   the invoice creation button: I would like to completely disable the manual creation
   as I have imposted the creation of invoices at the status order “completed”. 
   So I’m looking for a way to initially disable the button of invoice in order 
   list and order detail, and having it enabled only when the status is changed 
   to “completed” so to allow the admin to see the invoice created. Is it possible?

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

 *  Plugin Contributor [kluver](https://wordpress.org/support/users/kluver/)
 * (@kluver)
 * [8 years ago](https://wordpress.org/support/topic/disable-button-create/#post-10322115)
 * Hi [@licoreo](https://wordpress.org/support/users/licoreo/),
 * Yes this is certainly possible. You can unset these buttons when an order is 
   not yet set to completed with the following code snippets:
 *     ```
       // Only show PDF invoice action button on completed order
       add_filter( 'wpo_wcpdf_listing_actions', 'wpo_wcpdf_hide_invoice_button_untill_order_completed', 10, 2 );
       function wpo_wcpdf_hide_invoice_button_untill_order_completed( $listing_actions, $order ) {
           if ($order->get_status() !== 'completed') {
               unset($listing_actions['invoice']);
           }
           return $listing_actions;
       }
   
       // Only show PDF invoice button in meta box on completed order
       add_filter( 'wpo_wcpdf_meta_box_actions', 'wpo_wcpdf_hide_meta_box_invoice_button_untill_order_completed', 10, 2);
       function wpo_wcpdf_hide_meta_box_invoice_button_untill_order_completed ($meta_box_actions, $post_id) {
           $order = wc_get_order( $post_id );
           if ($order->get_status() !== 'completed') {
               unset($meta_box_actions['invoice']);
           }
           return $meta_box_actions;
       }
       ```
   
 * You should place these snippets in the functions.php of your child-theme. If 
   you haven’t worked with code snippets or functions.php before please read this:
   [How to use filters](https://docs.wpovernight.com/general/how-to-use-filters/)
 * I hope this helps!
 *  Thread Starter [Andrea](https://wordpress.org/support/users/licoreo/)
 * (@licoreo)
 * [8 years ago](https://wordpress.org/support/topic/disable-button-create/#post-10322922)
 * it works perfectly, many thanks!

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

The topic ‘disable button create’ 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 button](https://wordpress.org/support/topic-tag/disable-button/)

 * 2 replies
 * 2 participants
 * Last reply from: [Andrea](https://wordpress.org/support/users/licoreo/)
 * Last activity: [8 years ago](https://wordpress.org/support/topic/disable-button-create/#post-10322922)
 * Status: resolved