Skip to main content

Ubercart Tax Per Product

Published on
Recently I had to configure a client's Ubercart to tax per product to prevent gift certificates from being taxed at checkout. Ideally I wanted to add a "NOT" rule to my sales tax rate item within Ubercart; but, Drupal only supports "AND" and "OR" operators. Read my run down on my pitfalls and eventual success in setting up Ubercart tax per product. I tried a few Google searches and came up with year old threads that did not provide much of a solution, or the solution was for previous versions of Drupal and Ubercart. And so I tried playing around with a few things. Products with certain attribute I added a boolean field type to my Product content type called "Taxable." I then added a condition to my sales tax rule specifying "If Taxable is true, apply tax rate." However, I soon realized that Drupal's Rules does not play well with figuring out product attributes from the cart. In general you cannot tell Drupal to check every product for a certain attribute, looks like only the first few..or something. So I went back to the drawing board after much struggling. Then I saw the next amazing possibility, "Check an order's products." I really thought this was my golden solution. I created a new tax rate called "No Tax," weighted it at -10 so it would apply right away. My condition was set to match the proper item SKUs (which sucks sorting through by the way.) And I got nothing. It would not directly apply the taxes, but my sales tax still applied. I didn't understand it. Until I noticed the "Taxed Product Types" column. Taxed Product TypesAll of my products fell under the general product type, including gift certificates. So I went into my store configuration and to the manage classes section under "Products" (store/products/classes). I added a new class called "Gift Certificates". It wasn't much fun having to enter the same products again, but this new content type was not classified to a tax rate. Therefore I now I had set of products would could be charged a shipping rate but not a tax rate. In short, in order to have Ubercart tax per product and not have a tax rate applied, it must be part of a product class/type that does not have a tax rate applied to it. The same would follow for any specific product that requires a different tax rate.