Jump to content

How do I bypass creation of an invoice for free orders?


3sverhaeghe

Recommended Posts

We have invoicing switched on, obviously, because free orders are not the majority, but they are frequent enough for us to need a solution. One reason is that all these zero-value invoices need to be treated by our accountant, for no reason other than not to have gaps (sequential invoice numbering).


 


Is there a way to bypass the creation of an invoice for these free orders?


 


Obviously, if the invoice total > 0, the invoice must be created.


 


I've been messing about a little with the order statuses, but nothing seems to do the trick. I suppose I need to dig into the PHP of it, but I don't know how or where.


 


Your feedback will be deeply appreciated!


Link to comment
Share on other sites

  • 2 weeks later...

I also used free orders many years ago and left them. Free order isn't a real order, for me. You can replace it by a message or direct download for a virtual product.

OK, I understand, but the problem is we still need to track our coupons and their sources. Our system is built around coupons. Sometimes the coupon is linked to a specific person, but in other cases it is a general coupon sent to a group of people, allowing us to trace the coupon back to a certain marketing campaign. So not making it an order kind of cancels that out.

 

So no workarounds, then? That's disappointing. I'll keep looking then, or maybe change platforms if there's no way around it in Prestashop.

Link to comment
Share on other sites

Try to patch the PaymentModule::validateOrder function from

if ((int)Configuration::get('PS_INVOICE') && $order_status->invoice && $order->invoice_number)

to

if ($order->total_paid > 0 && (int)Configuration::get('PS_INVOICE') && $order_status->invoice && $order->invoice_number)
Link to comment
Share on other sites

  • 2 months later...

 

Try to patch the PaymentModule::validateOrder function from

if ((int)Configuration::get('PS_INVOICE') && $order_status->invoice && $order->invoice_number)

to

if ($order->total_paid > 0 && (int)Configuration::get('PS_INVOICE') && $order_status->invoice && $order->invoice_number)

Finally got around to trying this, but the only thing this changes is that no invoice is sent to the customer when the order is validated. However, the invoice is still generated, which is actually the part I'm trying to avoid. If the order total is 0, no invoice should be generated.

 

I think the problem is with the order statuses. When an order's payment method is classified as "free order" it automatically gets the order status "paid", which includes an invoice. I have created an order status "free order" but don't have a clue how to associate it with the payment method "free order".

 

I think it is the order.php file I need to modify, but I don't know which part exactly.

Edited by 3sverhaeghe (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...