VAT Required inside EU and NOT required outside EU, possible?

  • Posts: 117
  • Thank you received: 3
6 years 8 months ago #297243

-- HikaShop version -- : 3.5.1
-- Joomla version -- : 3.8.11
-- PHP version -- : 7.0.21

I would have the VAT field required for EU Companies meanwhile it should be not required if the company is outside EU. How could I write a rule in the"Address Format" field in the hika configuration?

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

  • Posts: 83766
  • Thank you received: 13555
  • MODERATOR
6 years 8 months ago #297247

Hi,

I don't see a way to do it without adding a dropdown where the customer could select something and then use the "display limited to" setting of the VAT field to restrict its display based on the selection the customer makes. That way, you can have the VAT field required but the required will only be enforced based on what you selected in that "display limited to" setting of the field.

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

  • Posts: 117
  • Thank you received: 3
6 years 8 months ago #297303

Thanls Nicolas for your answer. Till now I've done exactly what you suggested for every ecommerce website built but I think that this is not the most elegant and also correct solution. Till now I used a radio field to ask if company is inside or outside EU, according to that I show/hide the VAT field but I should always display the VAT field, not hide, bcause if a user from outside EU want to prive the VAT number of it's company he doesn't have a field to type it in.

Would you please considere this as a feature in next releases?

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

  • Posts: 83766
  • Thank you received: 13555
  • MODERATOR
6 years 8 months ago #297305

Hi,

This seems a bit too specific to have an option for that by default. Why not still charge VAT for EU companies without a VAT number, like we do on our website ?
However, it would be quite easy to do with a custom plugin. You would turn off the "required" setting of the VAT field and then have a plugin implementing the onBeforeAddressCreate and onBeforeAddressUpdate triggers to set the $do variable to false and display a joomla error message ( with $app->enqueueMessage() ) if the country of the address being created/updated is not in the list of the EU countries.
Any PHP developer should be able to easily do that.

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

Time to create page: 0.058 seconds
Powered by Kunena Forum