We are setting up a UK store with taxes applied to > Product and taxes > included in product pricing.
We have swapped to the ProductBasedTaxationInvoiceItemazationStrategy in merchello.config and can see how the ProductBasedTaxationVisitor is splitting the product price and the tax, which looks OK.
Up to this point, everything is working as we would expect.
However, when a discount coupon is added, the total tax (VAT) appears to be calculated on the full product price and not on the discount price after the coupon is applied. This results in the total VAT calculation being incorrect.
We've noticed that the ProductBasedTaxationVisitor has a comment saying "// TODO merchCouponAdjustedProductPreTaxTotal" - is this the missing step that would result in the correct tax calculation when there is a discount coupon?
We've made our own copy of the ProductBasedTaxationInvoiceItemazationStrategy and ProductBasedTaxationVisitor so we can implement a custom version, as required. However, we can't see any way to lookup the value for merchCouponAdjustedProductPreTaxTotal from within the ProductBasedTaxationVisitor. For example, how could we pass in the merchCouponAdjustedProductPreTaxTotal to clone.Price = ConvertToDecimal(item.ExtendedData.GetValue(priceKey))? Would this be the recommended approach?
You will need to work out the calculation yourself in the visitor. I haven't looked at this yet myself, but would check in the extended data collection for the incoming ILineItem. There will be something in there for either the discount line item or the product line item. It may not be called merchCouponAdjustedProductPreTaxTotal but I would expect something to be there.
For Product type ILineItems in the Visitor, we're not seeing merchCouponAdjustedProductPreTaxTotal or any other value in extended data that corresponds to a discount adjusted price.
However, if we inspect ILineItems of type Discount we can see a value for merchCouponAdjustedProductPreTaxTotal. The problem then, is that we can't see any relationship between the Discount ILineItem and the Product ILineItem that would allow us to lookup/reference the discount adjusted product price. The ProductBasedTaxationVisitor in the Merchello source code doesn't process ILineItems of type Discount and we can't seem to lookup a related discount from on a product from within the visitor.
I think the question is - how would we implement the "// TODO merchCouponAdjustedProductPreTaxTotal" in the ProductBasedTaxationVisitor?
Coupon discounts not included in product based tax calculation
Hi
We are setting up a UK store with taxes applied to > Product and taxes > included in product pricing.
We have swapped to the ProductBasedTaxationInvoiceItemazationStrategy in merchello.config and can see how the ProductBasedTaxationVisitor is splitting the product price and the tax, which looks OK.
Up to this point, everything is working as we would expect.
However, when a discount coupon is added, the total tax (VAT) appears to be calculated on the full product price and not on the discount price after the coupon is applied. This results in the total VAT calculation being incorrect.
We've noticed that the ProductBasedTaxationVisitor has a comment saying "// TODO merchCouponAdjustedProductPreTaxTotal" - is this the missing step that would result in the correct tax calculation when there is a discount coupon?
We've made our own copy of the ProductBasedTaxationInvoiceItemazationStrategy and ProductBasedTaxationVisitor so we can implement a custom version, as required. However, we can't see any way to lookup the value for merchCouponAdjustedProductPreTaxTotal from within the ProductBasedTaxationVisitor. For example, how could we pass in the merchCouponAdjustedProductPreTaxTotal to clone.Price = ConvertToDecimal(item.ExtendedData.GetValue(priceKey))? Would this be the recommended approach?
Many thanks
Sam
You will need to work out the calculation yourself in the visitor. I haven't looked at this yet myself, but would check in the extended data collection for the incoming ILineItem. There will be something in there for either the discount line item or the product line item. It may not be called merchCouponAdjustedProductPreTaxTotal but I would expect something to be there.
Hi Lee.
For Product type ILineItems in the Visitor, we're not seeing merchCouponAdjustedProductPreTaxTotal or any other value in extended data that corresponds to a discount adjusted price.
However, if we inspect ILineItems of type Discount we can see a value for merchCouponAdjustedProductPreTaxTotal. The problem then, is that we can't see any relationship between the Discount ILineItem and the Product ILineItem that would allow us to lookup/reference the discount adjusted product price. The ProductBasedTaxationVisitor in the Merchello source code doesn't process ILineItems of type Discount and we can't seem to lookup a related discount from on a product from within the visitor.
I think the question is - how would we implement the "// TODO merchCouponAdjustedProductPreTaxTotal" in the ProductBasedTaxationVisitor?
Many thanks
Sam
Hi Sam,
Did you figure this out? I am running into the same problems at the moment!
Thanks
Puck
Hi Puck
Unfortunately, no. In the end this was a show stopper for the project.
Sorry I couldn't help further.
Cheers
Sam
Hi Sam,
Damn! Thanks anyway
Puck
Another one here for whom this is a show-stopper.
Just for reference, please see this thread
https://github.com/Merchello/Merchello/issues/2153
is working on a reply...