In Drupal 7 Commerce, I have two product types, a service product and a physical product. I would like a 6% fee added to all physical products only when the user gets to the cart review page. Ultimately it would be a custom line item like a sub-total or tax.

Currently I've been able to add another sales tax to produce this functionality, however the tax is being applied to all products, rather than calculating the 6% on only the physical products. I'm not sure if this can be done with Drupal Rules, or if I'd need to use hooks.

1 Answer 1


In the interest of anyone else who is looking for an answer to this, here is how I solved adding tax to only specific product types, based on comment #1 here: https://www.drupal.org/node/1251444

Add elements to the rule applying tax to the line item

  • Entity has field: Parameter: Entity: [commerce-line-item], Field: commerce_product
  • Data Comparison: Parameter: Data to compare: [commerce-line-item:commerce-product:type], Data value: YourProductType

Add OR/AND for more based on needs.

Hope this helps someone!

tax rule only to specific product types

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.