Hi there,

We have a lot of products each with a base price and a discount price (both stored without VAT).
When the discount price is used the base price get the 'discounted' VAT added to it instead of its own. Example:

Product base price: 800 + 25% VAT (200) = 1000.
Discounted price: 400 + 25% VAT (100) = 500.

Shown price: 500 900 (save 44%)

It seems to be a bug with discounted products stored without VAT.
Any suggestions?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

recrit’s picture

if the VAT is not included in the price, then this module would not add anything to the base price.

I suspect that your rules might need to be reordered to calculate correctly. The VAT pricing rule should fire first and then the discounting rule.

  • Ensure that the rule "Calculate taxes: VAT" is weighted lighter (lower number) than your discounting rule (higher number).
  • Ensure that your discounting rule is applying discount as a 'Discount' Price component type and not 'Base Price'
F117’s picture

Hi Michael,

Thanks for your reply.
I've tried various rearrangements of the rules, which have given me various issues.

Logically the rules should be arranged as you mention, but this results in a wrong calculated total VAT on the final order overview..
This might correlate to another bug (http://drupal.org/node/1825886).

I've had to tweak the pricing formatter a bit, to get the right result in my case.
Is there a reason we're not using a .tpl.php? Would have been nice regarding the styling.

lodey’s picture

I have this exact same problem.
The VAT rule should surely be fired after discounts as this gives the true taxable value - at least as required in Britain.
HMRC tax requires VAT to be applied on top of discounted values. When I set up my VAT rule to fire this way I get all the correct values in the checkout summary etc.

The problem appears to be the way the price savings formatter is 're-calculating' the full amount pre discount. It uses the VAT added value, generated after the discount and adds that to the base price, but this will never be correct. Really we want to track what the VAT rate for this product line item is and use that for the calculation. Is it possible to grab hold of that value?

SoftService’s picture

Someone has a solution for this please?

Aambro’s picture

I've made a small patch that works for me so far. For me, the base price was wrong, because the module was only checking for "tax_rate" and not "vat_rate". Thus, the savings and percentage were also calculated wrong.

This fixes it.

hevmills’s picture

I came across this problem and started working on a solution similar to #5, but found it was adding the VAT calculated from the discounted price, which of course was wrong. I have created another patch here, using elements from the commerce_vat module to calculate the inc vat sale price pre-discount.

It does this by finding all VAT rates in the component, and then applying the highest VAT rate to the base_price.

This seems to work here for me.

ordermind’s picture

Status: Active » Needs review
FileSize
4.62 KB

There is actually a correctly calculated original value already available in commerce_price_savings_formatter_field_formatter_view() so you don't need to reapply taxes there. Basically you can just grab that value and make it a lot more simple.

tijsdeboeck’s picture

Patch #5 worked perfect for me, simple & elegant.

I first tried patch #7, but the original values don't exist during checkout, so it showed some notices & didn't display the discounted price ofcourse.

fotograafinge’s picture

#5 is not working at all for me
#6 is not working right for me (higher original price than the real original price)
#7 is working great for me !! Thank you !!!

attiks’s picture

Version: 7.x-1.3 » 7.x-1.x-dev
FileSize
1.87 KB

Ran into the same problem, attached patches calculates the original price using the same VAT (if any) as the discounted price.

PS: Rules order matters (admin/commerce/config/product-pricing), first "Sale Price" then "Taxes"

Pomliane’s picture

#10 solves the issue here, many thanks @attiks! :)

bbujisic’s picture

Status: Needs review » Reviewed & tested by the community

#10 is RTBC.

lubwn’s picture

#10 Works perfectly!! Thanks mate!

blueblot’s picture

#10 what a time saver, finally solved this issue.
Great job @attiks