Skip Invoice creation
-
Hi,
Please, is it possible to skip invoice creation/association to an order based on the payment method (CoD for instance) ?
This might be a possible implementation in the functions.php, but a hook would need to be available – and maybe it is – :
// 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 ) { $excluded_methods = array( 'cod', 'bacs' ); $payment_method = get_post_meta( $order->id, '_payment_method', true ); if ( $document == 'invoice' && in_array( $payment_method, $excluded_methods ) ) { return false; } else { return $condition; } }
For now I will try a modified version of invoice.php at line 437 :
$payment_method=$order->get_payment_method(); $excluded_methods = array( 'cod', 'bacs' ); $free_order_enable = Wf_Woocommerce_Packing_List::get_option('wf_woocommerce_invoice_free_orders',$this->module_id); $invoice_creation = 1; if(($free_order_enable == "No")|| in_array( $payment_method, $excluded_methods )){ if(\intval($order->get_total()) === 0){ $invoice_creation = 0; } }
Thank you.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Skip Invoice creation’ is closed to new replies.