Generate invoice only when company name field is filled in
-
Hello,
is it possible to generate an invoice when the order changes to completed only if the “Company name” field is filled in? At the moment I have this code but it is not working.
add_filter( ‘wpo_wcpdf_custom_attachment_condition’, ‘wpo_wcpdf_invoice_attachment_condition’, 100, 4 );
function wpo_wcpdf_invoice_attachment_condition( $condition, $order, $status, $template_type ) {
// only apply condition to invoices
if ($template_type == ‘invoice’) {
$billing_company = $order->get_billing_company();
// do not attach invoice if billing company is not filled in
if (empty($billing_company)) {
$condition = false;
}
}return $condition;
}
- The topic ‘Generate invoice only when company name field is filled in’ is closed to new replies.