Types of Taxes
Drupal Commerce can do lots of things, but it does two major kinds of taxes "out of the box".
- Sales Tax is the style of tax often used in the US, where many governmental entities impose their own tax on every purchase. It's typically added as a line item in the subtotal.
- VAT is used in much of the rest of the world. In VAT, the total shown to the customer already includes the tax, and nothing is added in the subtotal section (although Drupal Commerce does itemize the tax portion of the total.)
If you have a tax which is added to every order without any complex rules, there's nothing to it. Visit the tax rate configuration at Administration -> Store -> Configuration -> Taxes (admin/commerce/config/taxes) and add a tax rate.
For example, to add a sales tax of 10%, I can click "Add a tax rate", fill in the form, put a rate of 0.10, and that's all there is to it. An extra 10% subtotal line item will be added to every order
Unfortunately, the world is not set up to allow us to do simple taxes all the time, and we end up needing rules for them. Drupal Commerce, though, is up to the task. It uses the Rules engine to allow
you great power.
Most of the time, we'll be applying different taxes based on the location of the buyer. There are other applications, but we'll demonstrate how to do it based on order address:
- Create a tax. Let's use a sales tax, a Colorado State Sales Tax of 4.3% (.043).
- After creating the tax, you'll be on the Taxes page again. Click "configure component" next to your new tax. That lets you have direct access to the rule that will control this tax.
- Note that there are no conditions yet (because the default is a tax that's always applied). We're going to add a condition.
- Click "Add Condition"
- Select the "Order Address Component Comparison" condition.
- Choose line-item:order as the data selector.
- Choose the address to work with. If you're using the Commerce Kickstart install profile, you'll probably have just one option here, "Address".
- Choose the address component to work with. I'm going to use "Administrative area (State/Province)"
- Set the operator to equals.
- I'll set the value to "CO", the code for the state of Colorado that is used under the covers in Drupal Commerce forms.
That's it. You can add other taxes based on other address components as demonstrated in the screencast.
Here are two screencasts, the first on basic taxes and the second on conditional taxes.Source: drupalcommerce.org