• Resolved mygreenfootprint

    (@mygreenfootprint)


    Is it possible to selectively generate invoices rather than have them auto generated?

    Also is it possible to auto generate invoices for a specific payment type only?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Ewout

    (@pomegranate)

    The plugin generates the invoices when they are needed for the email attachment. If you disable the email attachment they will not be generated automatically and you can manually choose which orders you want to create an invoice for.

    If you need to limit the invoices to a specific payment method you’ll have to use a small code snippet (you’ll have to replace bacs with the internal name/’slug’ of the payment method you want to limit the invoices to):

    
    add_filter('wpo_wcpdf_document_is_allowed','wpo_wcpdf_prevent_on_hold_invoices',10,2);
    function wpo_wcpdf_prevent_on_hold_invoices( $is_allowed, $document ) {
    	if ( !empty($document->order) && $document->get_type() == 'invoice' && $document->order->get_payment_method() != 'bacs' ) {
    		$is_allowed = false;
    	}
    	return $is_allowed;
    }
    

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

    Thread Starter mygreenfootprint

    (@mygreenfootprint)

    Thank you this is appreciated. I will attempt later today and revert if further assistance needed.

    Kerry

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Selective Invoicing’ is closed to new replies.