I’m sorry if I haven’t been clear, I’ll do my best to explain how this works!
First I’ll copy paste the relevant section from the link from my previous post:
Invoice numbers are assigned at the moment a PDF invoice is created, either manually (by pressing the buttons or executing the bulk action), or automatically (by means of email attachment). This depends completely on the plugin settings. If you attach the invoice to the Admin New Order email, this means the invoice (and invoice number!) will be created immediately after the order is placed – for most setups, this is not recommended!
and the key to the answer following:
The ‘safest’ way is to attach the PDF invoice only to the Customer Completed Order email and the Customer Invoice email. This will make sure an invoice number will not be created before the order is completed.
You wrote that you disabled the attachment to the admin new order email, but if you’re still attaching the PDF to another email (or pressing the button in the admin), it will create the invoice anyway. The plugin doesn’t automatically create invoices unless it is sent by email.
The invoice button is always visible – regardless of the presence of an invoice! If you want to hide the button for non-completed orders, you need a filter (read this on how to use this).
/**
* Remove invoice button if order is not completed
*/
add_filter( 'wpo_wcpdf_listing_actions', 'wpo_wcpdf_restrict_invoice_button', 20, 2 );
add_filter( 'wpo_wcpdf_meta_box_actions', 'wpo_wcpdf_restrict_invoice_button', 20, 1 );
function wpo_wcpdf_restrict_invoice_button ($actions, $order = '' ) {
if (empty($order)) {
global $post_id;
$order = wc_get_order( $post_id );
}
if ($order->status != 'completed' && isset($actions['invoice'])) {
unset($actions['invoice']);
}
return $actions;
}
For the My Account page you can set this via the PDF Invoice settings.
Let me know if you need more help with this!
Ewout