Currently, the discount module doesn't handle/support VAT.
However, there are existing solutions in order to support that (See #2276227: [META] Use order discount with VAT).
Lately, a fix was committed to make sure discount line items weren't recreated on each cart refresh (See #2905616: Discount line items are always recreated on each cart refresh.).
As a consequence, we're currently only removing discount price components, so if there's any other price component present on the discount line items such as VAT that needs to be removed, it won't be by default.
There's currently a way to do this using the alter hook called inside commerce_discount_remove_discount_components()
via the hook_commerce_discount_remove_price_component_alter()
, but there's no context about the line item that's being manipulated, you can basically get the component, but there's no way to know the VAT component belongs to the discount line item so you'd risk removing VAT on non discount line items.
Comment | File | Size | Author |
---|---|---|---|
#2 | commerce_discount-remove-all-price-components-on-discounts-2920056-2.patch | 2.8 KB | jsacksick |
|
Comments
Comment #2
jsacksick CreditAttribution: jsacksick at Centarro commentedAttached my proposal to fix this.
Comment #3
jsacksick CreditAttribution: jsacksick at Centarro commentedComment #4
jsacksick CreditAttribution: jsacksick at Centarro commentedThis needs tests, but since I need that for a project pretty quickly, I'll commit that as it is, and write a test in a follow-up issue.
Comment #6
jsacksick CreditAttribution: jsacksick at Centarro commented