Discussions

Tax Conditions

Hi.

I have two VAT tax rates (23% and 13 %) and some of my products have the 23% tax rate and some of them the 13% tax rate included in their price.

So as a bad result in all of my products both of the tax rates are calculated.

What condition should i make in rules so that each product should only have the tax rate specified when setting up the price of the product.

thank you

Posted: Nov 3, 2011

Comments

S1L on April 4, 2012

You probably won't need to set any Rule conditions.

First make sure you've selected the right tax per product at the Commerce product SKU level. It's called 'Include tax in this price'. The list of products you need to check can be found at admin/commerce/products .

Then disable the default Rule that applies every VAT to every product on the site. The Rule is called 'Calculate taxes: VAT' and can be found at admin/config/workflow/rules

more information at:
http://drupal.org/node/1508320#comment-5810920

tahiticlic on October 1, 2012

Same needs here.

I can't see why disabling always applied VAT would solve the problem to have a VAT rate depending on the product (or on a product field in my case).

Could you explain the solution please ?

For instance, for a product A I need to set a VAT rate of 5% and for a product B a rate of 10%.

Thanks for your help!

amorales on November 3, 2012

Hello.

I had the same problem and found the solution in a video of rfay. It's not the same case but I learned how rules and components work.

Here is the video: http://vimeo.com/22625018

And the steps I've followed:

Note: I've configured the tax calculation by a field in the product entity for the tax type. It can be done for the product type instead.

1 - Set the taxes (in my case VAT) you need. I needed 21% and 10%.
2 - Create a new taxonomy vocabulary, and a term reference for each tax.
3 - On the product entity (not display product), create a new field and select the taxonomy term yoy have created, set as mandatory with drop down list.
4 - Go to taxes and click on configure component for the tax. (next steps have to be done for all taxes). You can go to this option directly from admin/config/worfkflow/rules/components

In the component rule, you have to set the condition for check if a product has the taxonomy term. (This can be done with a type of product, but I prefer to do it depending on a taxonomy term. With a product type it's not needed to create the taxonomy and the new field in the product entity).

The problem to achieve this is when you try to add a new condition you can not specify the data selector that you need,in this case, the product field for the taxonomy term. (or type of product). For doing this you have to create a JOIN between the product entity and the commerce line item entity.

5- Add a new condition of the type "Entity has a field". On the data selector select "commerce-line-item" and on the product field value select "commerce_product".

Now you are able to have the data selector you need for the product entity.

6 - Add a new condition of the type "Entity has a field". On the data selector select "commerce-line-item:commerce-product" and on the product field value select field of the product you have created previously.

7 - Add a new condition of the type Data Comparison. Here is where we compare the taxonomy term id. On the data selector set "commerce-line-item:commerce-product:NAME_OF_YOUR_FIELD:tid" and on the value insert yje term id of the taxonomy with the tax you have created.

8 - Finally add a condition Data value is empty with the selector "commerce-line-item:commerce-product:NAME_OF_YOUR_FIELD:tid" and click on negate. With this we are ensuring that the field is not empty.

Hope this helps.

gggdrpl on May 2, 2013

amorales@ Thanks so much for sharing your own way of applying what's explained in rfay's video. This variation of controlling a VAT tax through the use of taxonomy terms is exactly what I was trying to achieve but I was having trouble to get it working. Thanks to your detailed description finally got it and it works! It helped me better understand how the Rules module does its job!

Now my checkout pages show the total discount being subtracted from the subtotal. That's very fine but I'd like to show exactly which products apply for a discount and which don't and I guess that's just a matter of modifying a little bit the views provided for the shopping cart and the checkout summary.

flo81 on July 9, 2013

Awesome ! Not only you gave me a nice solution to my problem, but you also made me understand the true power of Rules...
Thanks a lot