Here's is what I want to accomplish:

  • There are 2 taxes in my country: 6.5% & 23%. Every product has to be matched with 1 of these 2 VATs (I'm currently using a taxonomy vocabulary holding these 2 VAT values instead of using commerce tax module)
  • A discount should always be available, based on total order's amount, excluding tax e.g. an order's total (with no tax included in base prices) of €0,01-€50,00 awards the customer with a discount to the order's total (including tax) of -5%, from €50,01 to €80,00 gives a discount of -8% etc etc

What I want to accomplish: - Customer adds products to cart (product prices are displayed excluding tax, ie w/o components) and heads to checkout. According to order's total (addition of products' base prices w/o tax), the appropriate discount will be applied. - Final Price = (Products' base prices + their appropriate taxes)*Pre-calculated Discount + Shipping Cost

Example: Shopping cart includes: - Product 1: €20 base price (6.5% VAT) - Product 2: €25 base price (23% VAT) Checkout Process:

  1. Discount pre-calculation: Total base price is €20 + €25 = €45. As a result, the customer should be awarded with a -5% discount (see available discount rates above).

  2. Order's total including products' VATs = (€20 + €20*0.065) + (€25 + €25*0.23) = €21.30 + €30.75 = €52.05

  3. The pre-calculated -5% discount from step 1 is applied: €52.05 - €52.05*0.05 = €49.45 and that's what the customer has to pay for the products in his/her cart.

  4. Order's weight is calculated and a shipping flat rate is applied (I have this functionality already working). As a result, the shipping cost is added to €49.45 and we finally get the sum that the customer will have to pay using one of available payment methods.*

I would appreciate your suggestions on how to make this happen.

Tricky parts:

  • different products can have different VAT (23% or 6.5%).
  • The discount has to be calculated by adding all products' base prices (NOT including tax) and THEN applied to line item (including tax) prices.
  • It would also be nice if VATs & discount were displayed to customer in order's review.

1 Answer 1


You can achieve what you're looking for using some module and disabling others. This explanation is based on Drupal Commerce (7.x).

  1. Uninstall standard Commerce Tax module since it leads to weird results with different VAT if you aren't a Rules master as exposed in this issue on drupal.org.
  2. Install Commerce European Union VAT (commerce_eu_vat) choosing the right country: the module has a good written API and you can adapt it for extra-EU countries easily. Now you can assign product by product the right VAT and even assign a default VAT by product type via "manage fields" on product variations administration. default VAT
  3. Install Discount (commerce_discount) module. You can set discount per product and per order (your case). Create a new discount, e.g. "My funny discount".
  4. Now you can create your per-order discount. Every time you create a new discount it appears on both Discount page and on Pricing rules. Since VAT is sometimes applied before Discount (in my case it was) then you have to change the Rule weight for your new discount. Go to the Pricing rules administration page, search for "My funny discount" > edit > Settings > Weight and give it a negative weight to apply the discount before the VAT. Note: when you override the discount you cannot save it anymore since you've changed the parent Rule. Just revert the rule to make it editable again and then reapply the weight trick. discount weight on Rules
  5. Now you have to hide unwanted components from your price on display: to do this install Commerce price by components (commerce_price_components). On your product type > Manage display you can change your price field widget from "Formatted amount" to "Price by components" and check only Discount and Base price, excluding VAT and other components. edit components

Here the result on checkout:

List item

Hope this helps.


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.