• Resolved sm7uge

    (@sm7uge)


    Hello and thanks for a great plugin!

    Is there a way to skip creating an invoice for a certain order? I would like to have that function in the free version but I can’t see that it’s available.

    I have orders that must be invoiced in a separate system to get paid by the customer. But if a PDF-invoice is created and sent by mail, AND I create an invoice manually in another system, there will be two invoices… and the PDF-invoice will have taken one of the invoice numbers in the number series for invoices. Hm…?

    • This topic was modified 5 years, 7 months ago by sm7uge.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Ewout

    (@pomegranate)

    Technically that’s possible with the wpo_wcpdf_document_is_enabled filter. But to be able to give an example we need a bit more information. How are these orders identified?

    Thread Starter sm7uge

    (@sm7uge)

    I would like to choose manually for each order that won’t require an invoice the be created. There is no way of automatically indentify the order.

    I would be more than happy if it worked like:

    – Open the order
    – Set a checkbox or whatever, to prevent the invoice to be created
    – Save order, return to the order list and click Completed when done

    Plugin Contributor Ewout

    (@pomegranate)

    Adding additional interface elements is not trivial and beyond the support we can give for the free version. But if you always manually approve all orders, you could also apply the rule that an invoice should have been manually created before it will be attached to the email. So instead of setting a checkbox to prevent the invoice from being created, you click the invoice button to create it for the ones that do.
    Then if you put this filter in place:

    
    add_filter( 'wpo_wcpdf_custom_attachment_condition', 'wpo_wcpdf_only_email_existing', 10, 4 );
    function wpo_wcpdf_only_email_existing( $attach, $order, $email_id, $document_type ) {
    	$document = wcpdf_get_document( $document_type, $order );
    	if ( empty($document) || $document->exists() === false ) {
    		$attach = false;
    	}
    	return $attach;
    }
    

    The plugin will only email the PDF for orders that had already have an invoice (created by the admin).

    If you haven’t worked with code snippets (actions/filters) or functions.php before, read this guide: How to use filters

    Hope that helps!

    Thread Starter sm7uge

    (@sm7uge)

    Thank you! That works perfectly for now.

    Take it as a request for the paid version. Some way to manually disable invoice creation when using the standard function to mark the order Completed. There is a section on the order to set invoice number and time, perhaps itegrate this setting there.

    Anyhow, thank you very much for your help! ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Is there a way to skip creating invoice for certain order?’ is closed to new replies.