• Hello,
    I would like only an invoice to be sent if the customer orders via invoice purchase in the shop. Is there a filter with which you can make this possible? No invoice should be issued for any other payment method.

Viewing 1 replies (of 1 total)
  • Plugin Contributor alexmigf

    (@alexmigf)

    Hello @danielkn

    Should be possible using the code snippet below, just add it to your theme functions.php file and replace the payment method:

    add_filter('wpo_wcpdf_custom_attachment_condition', 'wpo_wcpdf_disallow_invoice_custom_payment_method', 10, 4);
    function wpo_wcpdf_disallow_invoice_custom_payment_method( $condition, $order, $status, $document_type )
    {
    	if ( !empty($order) && $document_type == 'invoice' ) {
    		$payment_method_title = is_callable( array($order,'get_payment_method_title') ) ? $order->get_payment_method_title() : '';
    		if ( stripos( $payment_method_title, 'my_payment_method' ) !== true ) { // replace 'my_payment_method' with your current payment method slug
    			$condition = false;
    		}
    	}
    	return $condition;
    }

    If you never worked with actions/filters, please read this documentation page: How to use filters

Viewing 1 replies (of 1 total)
  • The topic ‘Invoice only for certain payment options’ is closed to new replies.