lunar icon indicating copy to clipboard operation
lunar copied to clipboard

The VAT number is not displayed at the order details if a legal person made the order

Open KingaOrsii opened this issue 11 months ago • 7 comments

  • Lunar version: 1.0.0-beta.6
  • Laravel Version: 11.35.1
  • PHP Version: 8.3.15
  • Database Driver & Version: MySQL 8

Expected Behaviour:

The VAT number (and all other meta field items) should appear at the order details if the order was created by a legal person. OR The VAT number should be saved to the DB in a separate field and handled at the order details as any other field.

Actual Behaviour:

The company's VAT number is not displayed at the order details on backend (nor in the generated PDF), and it should if the order was made by a legal person.

Steps To Reproduce:

Create an order as a legal person, add company details. Check the order on backend. Observe that the given VAT number is not appearing at the order details, nor in the generated PDF.

KingaOrsii avatar Jan 21 '25 05:01 KingaOrsii

Thanks @KingaOrsii Whilst I agree this could be useful, I'm not sure assuming vatNumber in the meta is the correct way as it's not part of the core and undocumented. I'll bring @glennjacobs on here to see if he has any opinions on the approach.

alecritson avatar Feb 12 '25 13:02 alecritson

No, I think it demands it's own specific field.

glennjacobs avatar Feb 12 '25 13:02 glennjacobs

Thanks for your response. So are you suggesting that there should be a separate DB field for vat number?

KingaOrsii avatar Feb 13 '25 05:02 KingaOrsii

Correct :) we can then document and use it properly throughout the core and panel.

alecritson avatar Feb 13 '25 08:02 alecritson

Yes, as this is a common requirement to store a customer's VAT number, I think it deserves it's own database field.

We need to be storing this with the billing entity, which in Lunar's case would be the billing address. Addresses in the system can of course be used for delivery also, but this gives flexibility if someone does for some reason need to store it against a delivery address.

We have three address tables to consider: addresses, cart_addresses & order_addresses.

Once updated in the core, we can then add some display logic to the admin panel.

glennjacobs avatar Feb 13 '25 08:02 glennjacobs

I created a new pull request if you don't mind. I added a new DB field for the VAT number, also renamed vat_no to vat_number at the customer.

https://github.com/lunarphp/lunar/pull/2106

KingaOrsii avatar Feb 14 '25 12:02 KingaOrsii

Thanks, looks good. I'll give it a proper review soon.

glennjacobs avatar Feb 14 '25 13:02 glennjacobs

Pretty sure this has been done now.

glennjacobs avatar Nov 11 '25 18:11 glennjacobs