How to setup a rule
How to assign a rule to my products
The product edit view has on the first tab the prices. Vm selects first the correct price and starts then the calculation. Any price can have its own tax and discount settings.
Clicking on the dropdown you see the following selection:
- apply none, means that no rule is applied, in any case.
- apply default/generic rules, means that the system selects the rule by the set conditions
- apply name1, means that this rule is used, in any case
You should always prefer the default/generic rules setup. The other selections work as "override" and the system does not care for anything like shoppergroup, category or similar. It is a legacy of VM1, which can still be used for temporarly or exceptional pricing setups.
But how to assign the rules now with the default/generic setup? The trick is done with categories.
The simplest tax setup
Just create a normal tax of type vat tax "Vat tax per product". Just use as Math operation +% and as value for example 20, for 20%. Select your shop currency for example euro and name it "vat 20%". Do not select any below. Store it.
=>Any product in your store is now taxed with "vat 20%".
Tax setup by categories
Lets first create a new categories, we name it "vat 20%" and another with 10%. Important, be certain to store it unpublished.
Then edit the last calculation rule again "vat 20%", just add your category "vat 20%" to it. Just use for the rule with name 10%, the category vat 10%.
Now enter your product edit view and just select the "generic rules" and add the product to the unpublished category vat 20%. Store it and use the small link in the title to see the product directly in the frontend. The VAT 20% should be active now.
Why with categories, why we cannot set directly multiple taxes?
The simplest tax setup does not even need a configuration per product. VirtueMart rule number 1, if nothing is set, it counts for all. This is very handy for shops with a simple tax setup. The work to add a tax or a category to a product is the same. Additionally you can of course also just use normal categories for different taxes. For example you can use for a rule the categories "vat 20%" and "electronic articles" (We assume in our country taxed with 20%). With this setup, we have again nothing todo for electronic articles. Now you have just to add the category to products taxed by 20% not being in the "electronic articles" category. The unpublished categories are also handy to build groups of rules.
Child products often have no categories, how to handle that?
A child product does inherit the categories from the parent. You need to set a category to a child product only, when you want that a child product is browseable. This is the case if your parent is used as product pattern. In the other case, when the children are used for variants, you usually do not set any category and let the parent handle it.
General notes to rounding
VirtueMart provides two different rounding modes for the calculations. Round only displayed values or use the rounded values in between. The problem is that the Distributive property is not valid for rounded values, see Wikipedia Distributive property and Rounding
General notes to vat calculation
The VAT is calculated from the baseprice, the net. So if our net is 9€ and our vat is 33.33%, we get 12 euro for gros. But when you use discounts after the tax, we have to recalculate the vat, because the vat is based on the net and not on the amount of your wares, despite to a toll. Some people confrontated us in the forum, that the calculation is 12€ - 33.33% of 12€. This is completly wrong, because the new net would be 8€ then. It is 12€/(1+33.33%).