Skip to content

Taxes overview

Types of Taxes

Drupal Commerce can do lots of things, but it does two major kinds of taxes "out of the box".

  1. 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.
  2. 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.)

Simple Taxes

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

Conditional Taxes

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:

  1. Create a tax. Let's use a sales tax, a Colorado State Sales Tax of 4.3% (.043).
  2. 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.
  3. Note that there are no conditions yet (because the default is a tax that's always applied). We're going to add a condition.
  4. Click "Add Condition"
  5. Select the "Order Address Component Comparison" condition.
  6. Choose line-item:order as the data selector.
  7. Choose the address to work with. If you're using the Commerce Kickstart install profile, you'll probably have just one option here, "Address".
  8. Choose the address component to work with. I'm going to use "Administrative area (State/Province)"
  9. Set the operator to equals.
  10. 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.

Drupal Commerce Tax Introduction: Sales Tax and VAT from Randy Fay on Vimeo.

Drupal Commerce Conditional Sales Tax from Randy Fay on Vimeo.