I am using Prestashop 1.7 and I need to make the VAT number only mandatory for billing addresses, but optional for delivery addresses. This is because many of the clients of my store are professionals/companies that need to have the VAT on the invoice, but who send the product directly to their clients from our platform, so they do not have to enter/know the CIF of the client that receives the shipment.
I've searched but can't find anything, so I've tried to do it myself, but I don't get full functionality.
This is what I have done so far:
- I marked vat_number as non-mandatory in the Clients->Addresses backend section to be able to control the mandatory nature of the field during the purchase process.
- In the payment process (Addresses step), if the customer uses the same address for delivery and invoice, I force him to enter a VAT number.
- However, if they use different addresses, I force them to enter a VAT number for the invoicing address only and allow them to leave empty that field in the delivery address.
- In the "Your invoicing address" subsection of the "Addresses" section, I disable the addresses that do not have the CIF filled in so that the customer cannot select them.
The problem is this: if the customer goes to their personal "Addresses" section and removes the VAT number from the address used for the invoice (they can do that because I had to mark the field as not required for it to work) and goes back to the checkout process, Prestashop goes directly to the next step (Delivery Method) and allows them to continue with the checkout process and the result is an order with an invoicing address without the VAT number.
Is there any native Prestashop way to do this or any module?
Or does anyone know how can I detect in the "Delivery method" step which addresses the customer has selected and force them to go through the "Addresses" step if there isn't any VAT number in the invoicing address?
Thank you very much