Sales tax calculated based on the line item's price rather than product's unit price

I am changing the product's unit price before the product is added to the cart. The sales tax must be based on the new changed unit price instead of the standard unit price. At present DC tax calculation uses the product's unit price instead of the changed price on the line item.

Any thoughts on how I can cleanly accomplish this? Also, do you think this is a bug?

Posted: Jan 12, 2012


metarama on January 12, 2012

I appended the standard action 'apply tax...' to my custom rule that was setting the line item's unit price. This effectively recalculates the sales tax. And now I get the correct amounts.

esper on January 13, 2012

I'm having the same problem with the sales tax being applied to the pre-discounted price.

I have a rules that gives the customer a 15% discount. It seems to work in the Cart but at Checkout, the Subtotal reflects the pre-tax total using the Unit Price without the discount.

The tax is subsequently applied to the wrong amount.

I tried adding the "Apply a tax rate to a line item" as you suggested but that didn't work.

rfay Randy Fay on January 17, 2012

It sounds like your product pricing rules need to be re-ordered. Each product pricing rule has a weight that you can set (under settings in the rules at admin/commerce/config/product-pricing). That determines the order they get evaluated in.

herkimermedia on February 8, 2014

Hi rfay,

Your suggestion helped me as well -- thank you!

It is probably self-evident to experienced Commerce users: but as a noob, I did not realize that the Product Pricing UI module needed to be enabled, in order to access the weight that you referenced above. (Hopefully this saves somebody else a few minutes of beating their head on their monitor.)

esper on January 17, 2012

Thanks Randy. I changed the weight and we now have the correct total.

However, the Subtotal in the Total Summary still show the pre-discounted amount. In a sense, that's correct since the full discount amount it subtracted and the tax applied to the correct subtotal.

It's just a little confusing. Perhaps we shouldn't use/show the discounted amounts in the shopping cart.

In any case, it would be great if we could chose which amount to use for the subtotal. I haven;t found a way to do this.

- George Esper

rfay Randy Fay on January 17, 2012

I think the subtotals and stuff are kind of confusing as well.

I think there's an issue going about some of this, but you might post a bug report showing how it works now and how you'd like it to work.

1kenthomas on February 3, 2012

First, if you use the method above, it will apply to all orders, not just, for instance, a single state.

Next, in a situation with a mixed bag of products, some discounte and some full price, tax looks be applied unevenly.

Can't we just tax the subtotal? Makes a lot more sense in 90% of the time?