Hi,
You can update your class order with this code.
if(!empty($order->order_status) && empty($order->order_invoice_id) && empty($order->old->order_invoice_id) && $order_type == 'sale') {
$config =& hikashop_config();
$valid_statuses = explode(',', $config->get('invoice_order_statuses','confirmed,shipped'));
$excludeFreeOrders = $config->get('invoice_exclude_free_orders', 0);
if(isset($order->order_full_price))
$total = $order->order_full_price;
else
$total = $order->old->order_full_price;
if(in_array($order->order_status, $valid_statuses) && ($total > 0 || !$excludeFreeOrders)) {
$this->database->setQuery('SELECT MAX(a.order_invoice_id)+1 FROM '.hikashop_table('order').' AS a WHERE a.order_type = \'sale\'');
$order->order_invoice_id = $this->database->loadResult();
$order->order_invoice_number = hikashop_encode($order, 'invoice');
}
}
After that, you have to create an option in the database, named "invoice_exclude_free_orders" and with the value "1".
It would be an advanced option (we have some options which are hidden).
If it's right for you, the patch would be validate and include in the next release of HikaShop.
(And the option would be managed by HikaMarket too).
Regards,