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

    (@pomegranate)

    Hi There,
    You can use the wpo_wcpdf_custom_attachment_condition filter for any rules you want to apply to automatic pdf invoice attachment.

    // exclude certain payment methods from automatic pdf creation
    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 == 'your_payment_method' ) {
    		return false;
    	} else {
    		return $condition;
    	}
    }

    Hope that helps!
    Ewout

    Thread Starter TeamCreative

    (@teamcreative)

    Wow! Helped me out, Thnks!!

    Hello

    My programming skills are limited. Where do I have to put this code? I would appreciate if you can tell me that Step-by-Step.

    Thanks…

    Plugin Contributor Ewout

    (@pomegranate)

    Hello SimWeb,
    This code should be placed in your theme’s functions.php or Custom Functions (some themes have a settings area for this). Your theme author should be able to help with this if necessary.
    After you have found functions.php, don’t forget to replace ‘your_payment_method’ in the code with the name/slug of the payment method that you want to exclude from invoicing.

    Ewout.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Exclude from payment method’ is closed to new replies.