add_filter('wpo_wcpdf_custom_attachment_condition', 'wpo_wcpdf_disable_free', 10, 4 );
function wpo_wcpdf_disable_free( $condition, $order, $status, $template_type ) {
// use $template type to make rules specific to the document
// ('packing-slip', 'invoice', 'proforma' or 'credit-note')
$order_total = $order->get_total();
if ( $order_total > 0 ) {
return $condition;
} else {
// free order, don't generate pdf
return false;
}
}
This code is wunderful, BUT there is a little problem with the generated PDFs left.
The invoice number is always zero.