Exclude invoice generation for private customer

  • Posts: 59
  • Thank you received: 0
6 years 3 months ago #285312

Hi! I'm looking a way to exclude the invoice generation for orders made by private customers, people which don't have any vat.
In fact in Italy private customers don't need to receive the invoice if they don't require it. They just need to receive the receipt in the shipped pack.

So I was looking a way to exclude invoice generation. I thought to create a new custom field, a radio button which says:
"do you need an invoice?" if user click on yes then are displayed invoice fields to fill and users will receive the invoice via email with your plugin (as it normally working). If user say no the system doesn't generate the invoice.

Is it possibile to achieve this result?
Could you help me to find the code to edit in order to make this check before to generate an invoice?

Thanks for your support.
Regards,
Simone

Please Log in or Create an account to join the conversation.

  • Posts: 81540
  • Thank you received: 13071
  • MODERATOR
6 years 3 months ago #285317

Hi,

How do your users get the invoice ?
A PDF in the confirmation email with the "PDF invoice plugin" ?
The "invoice" button when they edit their order ?
And for which version of HikaShop are you trying to do that ?
Based on that we might be able to provide a solution.

Please Log in or Create an account to join the conversation.

  • Posts: 59
  • Thank you received: 0
6 years 3 months ago #285365

User get the invoice only via email when order is confirmed through PDF invoice plugin.
For users is not allowed to print invoice on frontend, if is that what you mean saying:
The "invoice" button when they edit their order ?
I'm using Hikashop Business 2.6.2 at the moment but I'll upgrade if needed to do this job.

Please Log in or Create an account to join the conversation.

  • Posts: 81540
  • Thank you received: 13071
  • MODERATOR
6 years 3 months ago #285367

Hi,

In that case, you can add the code:

if(empty($order->billing_address->address_vat))
 return;
after the code:
$order = $class->loadFullOrder($orderId,true,false);
in the file plugins/hikashop/attachinvoice/attachinvoice.php

Please Log in or Create an account to join the conversation.

  • Posts: 59
  • Thank you received: 0
6 years 3 months ago #285439

Hi thanks for your support, code works.
I've been not so clear while explaining because seems that with your code no invoice is sent to the user but in website backend order panel the invoice has been created and numeration increased.
What i need is that no invoice is generated by hikashop if user is private user (so empty vat) in the entire website.
Hope that it's more clear now.

Thank you again, superb support!

Please Log in or Create an account to join the conversation.

  • Posts: 81540
  • Thank you received: 13071
  • MODERATOR
6 years 3 months ago #285440

Hi,

In that case, you also want to change the line:
if(!empty($order->order_status) && empty($order->order_invoice_id) && empty($order->old->order_invoice_id) && $order_type == 'sale' && !$already_invoice_number) {
to:
if(!empty($order->order_status) && empty($order->order_invoice_id) && empty($order->old->order_invoice_id) && $order_type == 'sale' && !$already_invoice_number && !empty($order->cart->billing_address->address_vat)) {
in the file administrator/components/com_hikashop/classes/order.php

PS: Please note that we're not supposed to answer such code customization requests, even more so when you don't even have an active subscription for your HikaShop.

Please Log in or Create an account to join the conversation.

  • Posts: 59
  • Thank you received: 0
6 years 3 months ago #285475

Really thanks for your support, I'll try to perform with your suggestion.
If we'll update this stuff about invoice we also will update checkout system and workflow using ajax so I'll renew my subscription.

Best regards,
Simone

Please Log in or Create an account to join the conversation.

Time to create page: 0.074 seconds
Powered by Kunena Forum