New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not reconvert discounts #20598
Do not reconvert discounts #20598
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love a PR that removes more code than it adds ❤️
@@ -570,19 +570,6 @@ private function getTemplateVarVouchers(Cart $cart) | |||
} else { | |||
$freeShippingOnly = false; | |||
$totalCartVoucherReduction = $this->includeTaxes() ? $cartVoucher['value_real'] : $cartVoucher['value_tax_exc']; | |||
$currencyFrom = new \Currency($cartVoucher['reduction_currency']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure you should remove it all 🤔 But maybe rather check if the currencies ids match, if they don't then you need to perform the conversion You can also use Tools::convertPriceFull
which (I believe) manages all these checks and conversion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tried many combinations with different currencies, different discount currencies, different kind of discounts and each time it worked well without performing any other conversion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So does it mean $cart->getCartRules()
already performs the conversion?
If this is something we changed we might need to mark this as a BC (if developers expect it to return not converted values)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll add it in the how to test section 😉
@atomiix I created a 20AED amount cart rule here: I then applied this cart rule on the product below but the price of the discount should be 4,60 € instead of 5,52 € |
@ngodefroy I think you forgot the tax: |
@atomiix OK for me, I misunderstood the "tax excluded" box, thank you. |
This change is