[Skip to main content](#vessel-content)

#   Vat problem in intra-community sale

##

- **[pljuarez](/forum/user/34788-pljuarez "View pljuarez's Profile")**
- [![pljuarez's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/34788-pljuarez "View pljuarez's Profile") Topic Author
- [ Offline](/forum/user/34788-pljuarez)

Less More

- Posts: 79
- Thank you received: 3
-
-

11 years 1 month ago -  11 years 1 month ago [\#217956](#217956) by [pljuarez](/forum/user/34788-pljuarez "View pljuarez's Profile")  *[Vat problem in intra-community sale](/forum/40-taxes/879981-vat-problem-in-intra-community-sale#217956 "-- HikaShop version -- : Business 2.6.0 -- Joomla version -- : 3.2.3 -- PHP version -- : 5.3.3  Hello, some time ago, I developed a plugin in order to check VAT number depending on custom field &quot;user&#95;type&quot;. You can find in topic &quot;&quot;.  It checks VAT number properly, but now our financial staff warn us about a problem with users with valid VAT number not in our country (Spain), because when a company with valid VAT number do an order, VAT must not apply because it is considering a &quot;Intra-community sale&quot;.  Looking for where VAT is calculated, I found a function named &quot;getTax&quot; in class currency.php  This function seems to filter depending on &quot;$type&quot; parameter. My question is, where can I set this &quot;type&quot; in checkout process? (note I have configured address before cart in checkout as you can see and I've set the &quot;Type of of address used for tax&quot; to billing.)  What can I do to set this parameter?  Regards")* was created by *[pljuarez](/forum/user/34788-pljuarez "View pljuarez's Profile")*

-- HikaShop version -- : Business 2.6.0
-- Joomla version -- : 3.2.3
-- PHP version -- : 5.3.3

Hello, some time ago, I developed a plugin in order to check VAT number depending on custom field "user_type". You can find in topic "[ Invalid VAT number for individuals, what can I do?](http://www.hikashop.com/forum/checkout/875355-invalid-vat-number-for-individuals-what-can-i-do.html)".

It checks VAT number properly, but now our financial staff warn us about a problem with users with valid VAT number not in our country (Spain), because when a company with valid VAT number do an order, VAT must not apply because it is considering a "Intra-community sale".

Looking for where VAT is calculated, I found a function named "getTax" in class currency.php Code:

function getTax($zone_id,$tax_category_id,$type=''){

This function seems to filter depending on "$type" parameter.
My question is, where can I set this "type" in checkout process? (note I have configured address before cart in checkout as you can see and I've set the "Type of of address used for tax" to billing.)
[ ![checkout.jpg](/forum/attachment/27164) ](/forum/attachment/27164 "checkout.jpg")

What can I do to set this parameter?

Regards

- [ ![checkout.jpg](/forum/attachment/27164) ](/forum/attachment/27164 "checkout.jpg") [ ](/forum/attachment/27164?download=1 "checkout.jpg")

Last edit: 11 years 1 month ago by [pljuarez](/forum/user/34788-pljuarez "View pljuarez's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQwLXRheGVzLzg3OTk4MS12YXQtcHJvYmxlbS1pbi1pbnRyYS1jb21tdW5pdHktc2FsZT90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86584
- Thank you received: 14325
-
-

11 years 1 month ago [\#217970](#217970) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Vat problem in intra-community sale](/forum/40-taxes/879981-vat-problem-in-intra-community-sale#217970 "-- HikaShop version -- : Business 2.6.0 -- Joomla version -- : 3.2.3 -- PHP version -- : 5.3.3  Hello, some time ago, I developed a plugin in order to check VAT number depending on custom field &quot;user&#95;type&quot;. You can find in topic &quot;&quot;.  It checks VAT number properly, but now our financial staff warn us about a problem with users with valid VAT number not in our country (Spain), because when a company with valid VAT number do an order, VAT must not apply because it is considering a &quot;Intra-community sale&quot;.  Looking for where VAT is calculated, I found a function named &quot;getTax&quot; in class currency.php  This function seems to filter depending on &quot;$type&quot; parameter. My question is, where can I set this &quot;type&quot; in checkout process? (note I have configured address before cart in checkout as you can see and I've set the &quot;Type of of address used for tax&quot; to billing.)  What can I do to set this parameter?  Regards")*

Hi,

The type is decided automatically by the function getTaxType which is called by the getTax function itself to know what is the type of the current user based on his billing or shipping address. If he fills the address_company field, he will be considered as a company, otherwise, an individual.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQwLXRheGVzLzg3OTk4MS12YXQtcHJvYmxlbS1pbi1pbnRyYS1jb21tdW5pdHktc2FsZT90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[pljuarez](/forum/user/34788-pljuarez "View pljuarez's Profile")**
- [![pljuarez's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/34788-pljuarez "View pljuarez's Profile") Topic Author
- [ Offline](/forum/user/34788-pljuarez)

Less More

- Posts: 79
- Thank you received: 3
-
-

11 years 1 month ago [\#218075](#218075) by [pljuarez](/forum/user/34788-pljuarez "View pljuarez's Profile")  Replied by *[pljuarez](/forum/user/34788-pljuarez "View pljuarez's Profile")* on topic *[Vat problem in intra-community sale](/forum/40-taxes/879981-vat-problem-in-intra-community-sale#218075 "-- HikaShop version -- : Business 2.6.0 -- Joomla version -- : 3.2.3 -- PHP version -- : 5.3.3  Hello, some time ago, I developed a plugin in order to check VAT number depending on custom field &quot;user&#95;type&quot;. You can find in topic &quot;&quot;.  It checks VAT number properly, but now our financial staff warn us about a problem with users with valid VAT number not in our country (Spain), because when a company with valid VAT number do an order, VAT must not apply because it is considering a &quot;Intra-community sale&quot;.  Looking for where VAT is calculated, I found a function named &quot;getTax&quot; in class currency.php  This function seems to filter depending on &quot;$type&quot; parameter. My question is, where can I set this &quot;type&quot; in checkout process? (note I have configured address before cart in checkout as you can see and I've set the &quot;Type of of address used for tax&quot; to billing.)  What can I do to set this parameter?  Regards")*

Thanks for your answer Nicholas.

Then, if I need to modify this behavior, should I modyfy this function?. Can I override this function in a plugin?

Regards

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQwLXRheGVzLzg3OTk4MS12YXQtcHJvYmxlbS1pbi1pbnRyYS1jb21tdW5pdHktc2FsZT90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86584
- Thank you received: 14325
-
-

11 years 1 month ago [\#218079](#218079) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Vat problem in intra-community sale](/forum/40-taxes/879981-vat-problem-in-intra-community-sale#218079 "-- HikaShop version -- : Business 2.6.0 -- Joomla version -- : 3.2.3 -- PHP version -- : 5.3.3  Hello, some time ago, I developed a plugin in order to check VAT number depending on custom field &quot;user&#95;type&quot;. You can find in topic &quot;&quot;.  It checks VAT number properly, but now our financial staff warn us about a problem with users with valid VAT number not in our country (Spain), because when a company with valid VAT number do an order, VAT must not apply because it is considering a &quot;Intra-community sale&quot;.  Looking for where VAT is calculated, I found a function named &quot;getTax&quot; in class currency.php  This function seems to filter depending on &quot;$type&quot; parameter. My question is, where can I set this &quot;type&quot; in checkout process? (note I have configured address before cart in checkout as you can see and I've set the &quot;Type of of address used for tax&quot; to billing.)  What can I do to set this parameter?  Regards")*

Modifying the function will be simpler.
You can just override the function with a plugin. You would have to either override the whole class file, or use the onHikashopGetTax trigger in a plugin to reload the taxes yourself, or recalculate all the taxes yourself using the same principle than the TaxCloud plugin.
Modifying the function in the core file will be way easier.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQwLXRheGVzLzg3OTk4MS12YXQtcHJvYmxlbS1pbi1pbnRyYS1jb21tdW5pdHktc2FsZT90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[pljuarez](/forum/user/34788-pljuarez "View pljuarez's Profile")**
- [![pljuarez's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/34788-pljuarez "View pljuarez's Profile") Topic Author
- [ Offline](/forum/user/34788-pljuarez)

Less More

- Posts: 79
- Thank you received: 3
-
-

11 years 1 month ago -  11 years 1 month ago [\#218164](#218164) by [pljuarez](/forum/user/34788-pljuarez "View pljuarez's Profile")  Replied by *[pljuarez](/forum/user/34788-pljuarez "View pljuarez's Profile")* on topic *[Vat problem in intra-community sale](/forum/40-taxes/879981-vat-problem-in-intra-community-sale#218164 "-- HikaShop version -- : Business 2.6.0 -- Joomla version -- : 3.2.3 -- PHP version -- : 5.3.3  Hello, some time ago, I developed a plugin in order to check VAT number depending on custom field &quot;user&#95;type&quot;. You can find in topic &quot;&quot;.  It checks VAT number properly, but now our financial staff warn us about a problem with users with valid VAT number not in our country (Spain), because when a company with valid VAT number do an order, VAT must not apply because it is considering a &quot;Intra-community sale&quot;.  Looking for where VAT is calculated, I found a function named &quot;getTax&quot; in class currency.php  This function seems to filter depending on &quot;$type&quot; parameter. My question is, where can I set this &quot;type&quot; in checkout process? (note I have configured address before cart in checkout as you can see and I've set the &quot;Type of of address used for tax&quot; to billing.)  What can I do to set this parameter?  Regards")*

Thanks Nicholas, I'll try to override the funtion in a plugin like you said in order to prevent modifications in futures updates.

Can you say me where can I find documentation about onHikashopGetTax trigger? (parameters, use, ...). I looked for information and I haven't found anything in documentation neither in the forum.

Regards

Last edit: 11 years 1 month ago by [pljuarez](/forum/user/34788-pljuarez "View pljuarez's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQwLXRheGVzLzg3OTk4MS12YXQtcHJvYmxlbS1pbi1pbnRyYS1jb21tdW5pdHktc2FsZT90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86584
- Thank you received: 14325
-
-

11 years 1 month ago [\#218209](#218209) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Vat problem in intra-community sale](/forum/40-taxes/879981-vat-problem-in-intra-community-sale#218209 "-- HikaShop version -- : Business 2.6.0 -- Joomla version -- : 3.2.3 -- PHP version -- : 5.3.3  Hello, some time ago, I developed a plugin in order to check VAT number depending on custom field &quot;user&#95;type&quot;. You can find in topic &quot;&quot;.  It checks VAT number properly, but now our financial staff warn us about a problem with users with valid VAT number not in our country (Spain), because when a company with valid VAT number do an order, VAT must not apply because it is considering a &quot;Intra-community sale&quot;.  Looking for where VAT is calculated, I found a function named &quot;getTax&quot; in class currency.php  This function seems to filter depending on &quot;$type&quot; parameter. My question is, where can I set this &quot;type&quot; in checkout process? (note I have configured address before cart in checkout as you can see and I've set the &quot;Type of of address used for tax&quot; to billing.)  What can I do to set this parameter?  Regards")*

Hi,

There is no documentation about it. It's a new trigger that has been added recently.

The parameters are:
onHikashopGetTax( &amp;$class, $zone_id, $tax_category_id, $type, &amp;$matches, &amp;$taxPlans)

$class : the currency class
$zone_id : the id of the current zone of the customer
$tax_category_id : the id of the tax category of the current product for which we're getting the tax rate
$type: the type of user that was calculated in the getTaxType function
$matches: an array of objects containing the tax rules and tax rates data that were loaded based on the previous parameters
$taxPlans: an array of objects containing the tax rules and tax rates data that were loaded before the filtering on the zone_id

What you'll have to do is to load yourself the tax rules and tax rates data objects you want in $matches based on your own rules so that the system can then use them for the calculations.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQwLXRheGVzLzg3OTk4MS12YXQtcHJvYmxlbS1pbi1pbnRyYS1jb21tdW5pdHktc2FsZT90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[pljuarez](/forum/user/34788-pljuarez "View pljuarez's Profile")**
- [![pljuarez's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/34788-pljuarez "View pljuarez's Profile") Topic Author
- [ Offline](/forum/user/34788-pljuarez)

Less More

- Posts: 79
- Thank you received: 3
-
-

11 years 1 month ago [\#218425](#218425) by [pljuarez](/forum/user/34788-pljuarez "View pljuarez's Profile")  Replied by *[pljuarez](/forum/user/34788-pljuarez "View pljuarez's Profile")* on topic *[Vat problem in intra-community sale](/forum/40-taxes/879981-vat-problem-in-intra-community-sale#218425 "-- HikaShop version -- : Business 2.6.0 -- Joomla version -- : 3.2.3 -- PHP version -- : 5.3.3  Hello, some time ago, I developed a plugin in order to check VAT number depending on custom field &quot;user&#95;type&quot;. You can find in topic &quot;&quot;.  It checks VAT number properly, but now our financial staff warn us about a problem with users with valid VAT number not in our country (Spain), because when a company with valid VAT number do an order, VAT must not apply because it is considering a &quot;Intra-community sale&quot;.  Looking for where VAT is calculated, I found a function named &quot;getTax&quot; in class currency.php  This function seems to filter depending on &quot;$type&quot; parameter. My question is, where can I set this &quot;type&quot; in checkout process? (note I have configured address before cart in checkout as you can see and I've set the &quot;Type of of address used for tax&quot; to billing.)  What can I do to set this parameter?  Regards")*

Thanks Nicholas, I'll try to make a plugin that override the function based on this trigger, I'll keep you up to date on my progress.

Regards

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQwLXRheGVzLzg3OTk4MS12YXQtcHJvYmxlbS1pbi1pbnRyYS1jb21tdW5pdHktc2FsZT90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.069 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
