I posted this on the http://www.drupalcommerce.org/ website but realized that it might not be the place to get support so i'll ask around here hopefully someone will have the answer/steps for me.

I've just recently started using Commerce for drupal (yeah less than a week ago!) and i'm setting up my store slowly but surely.

Right now i'm a the point where I need to set up taxes but here's the catch : since I will only (for now) ship to my province I do not need to set up different taxes based on location but rather on product type.

Here in Quebec we have two taxes the TPS (it's the Canadian tax for products and services) and the TVQ (Quebec tax on sales). The first one need to be applied on every transaction you make, the second is conditional.

In my store I have one "line item" and 2 different product types. The first one is "Books" and the second one is "teaching materials". For the books I need to have only the TPS applied (5%) and right now it's working fine.
For the teaching materials I need to have both taxes applied, so I need to know how to set up the taxes so I can have condition based on what type of product.
But it's not over!! It need to be calculated in a certain way.

First the TPS need to be applied on the total, then for the specific items you need to add to their total WITH the TPS applied and add the TVQ...

Here's an exemple for a "normal sale" in which case both taxes would be applied :

Sale price 100,00 $
TPS (100 $ × 5 %) 5,00 $
TVQ ([100 $ + 5 $] × 8,5 %) 8,93 $
Total 113,93 $

But let's say someone is buying a book (20$, and some material for 80$)

Sale price 100,00 $
TPS (100 $ × 5 %) 5,00 $
TVQ ([80 $ x 5 %] × 8,5 %) 7,14 $
Total 112,14 $

In this exemple you take the 80$ of "material" x 5% (= 4$) you add it up to get 84$ and then you add the TVQ to that amount (8,5%) and then you add the sale price, the TPS, the TVQ and you get the total..

Can anyone around here help me out? I get that I would have to play around with the condition and actions but how?

Comments

rszrama’s picture

Status: Active » Fixed

I don't think you'll have any issues. I actually had Canadian cumulative taxes in mind when planning out the tax calculation logic w/ Damien. You need to define your two tax rates and make sure their "weight" value puts them in the order you want them applied (i.e. set the weight of the TVQ to 1 or any value higher than that of the TPS). You can adjust the weight in the "configure component" form.

Then you're going to need a set of conditions on your TVQ component:

  1. "Entity has field" to make sure the line item has the commerce_product field. (We know it will, but Rules doesn't; this condition lets it know.)
  2. "Data comparison" to compare the product type found at commerce-line-item:commerce-product:type in the data selector dropdown.

This actually isn't a place to receive support, but I figured I'd give you a pass on the first one. Hope this helps, and hopefully we can clarify the appropriate support channel on DC.org. For now you might also try the Drupal Stack Exchange site (http://drupal.stackexchange.com).

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

rfay’s picture

Category: support » bug
Status: Closed (fixed) » Active

Hmm.. Ryan, I don't see any to set the weight on the tax rates. Not in the Commerce interface (admin/commerce/config/taxes/rates), not in the components interface in the rules interface (admin/config/workflow/rules/components)

I also don't see it under "edit" or "edit component".

I cannot do it by changing the 'weight' field in the rules_config table.

Did this get lost somewhere?

I *am* able to get this to work just fine by creating the rules in the intended sequence.

rszrama’s picture

Category: bug » support
Status: Active » Closed (fixed)

Yes, I'm not sure what I was referring to. It appears I was mixing up tax rates and tax types. The "configure component" link is particular to tax rates, but setting a weight is particular to tax types. What you'd need to do is use twi separate tax types instead of rates and then order them to your need in the product pricing rules configuration page. You could technically do this with tax rates if you created individual rules to apply each tax rate instead of using the default tax type rules that invoke tax rate components.

rfay’s picture

Status: Closed (fixed) » Closed (won't fix)

It's easy to add tax based on product type or on a checkbox "taxable" field on the product type.

However, doing cumulative tax on sales-tax type products does not seem to be possible.

I'll be happy to demonstrate, but don't think we have a solution for Canada yet.

rfay’s picture

Status: Closed (won't fix) » Closed (fixed)
rfay’s picture

rfay’s picture

@bluepills I posted a screencast showing how to do exactly this at http://vimeo.com/29725767