Skip to content
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

Set amount to the subtotal when the discount amount exceeds the subtotal #200

Conversation

jan888adams
Copy link
Contributor

@jan888adams jan888adams commented Sep 30, 2024

The cart discount reduces the total cart price, including price modifications like shipping costs. This behavior differs from percentage discounts, which only apply to the subtotal and do not affect additional costs.

This is fixed by setting the discount amount to the subtotal when the discount amount exceeds the subtotal.

Resolves: #199

@jan888adams jan888adams force-pushed the fix-cart-discount-applied-to-the-total-price-instead-of-the-subtotal branch from 5ae13a1 to f40dc6c Compare September 30, 2024 18:28
@fashxp
Copy link
Member

fashxp commented Oct 1, 2024

Not sure, if we should make that behavior configurable?
Or at least we merge that for the next minor and add a upgrade note to it - since it is a change in behavior that someone could use the way it is right now.

WDYT?

@jan888adams
Copy link
Contributor Author

That sounds like a good idea. I would implement the current behavior as the default, with an option to switch to the new calculation. Additionally, I would apply the change only to the fixed amount and deprecate the old method of calculating cart discounts with fixed amounts.

@jan888adams jan888adams marked this pull request as draft October 4, 2024 10:13
@fashxp
Copy link
Member

fashxp commented Oct 7, 2024

please just update the english translation file. the rest is translated via poeditor, see also https://pimcore.com/docs/platform/Pimcore/Multi_Language_i18n/Admin_Translations/#adding-your-own-admin-languages-since-v636

@jan888adams jan888adams marked this pull request as ready for review October 8, 2024 14:04
src/PricingManager/Action/CartDiscount.php Outdated Show resolved Hide resolved
@jan888adams jan888adams force-pushed the fix-cart-discount-applied-to-the-total-price-instead-of-the-subtotal branch from 991fd9a to fad0b13 Compare October 9, 2024 15:15
@fashxp fashxp self-assigned this Oct 10, 2024
@fashxp fashxp added this to the 1.3.0 milestone Oct 10, 2024
@fashxp
Copy link
Member

fashxp commented Oct 10, 2024

thanks again!

@fashxp fashxp merged commit 67e3b0e into pimcore:1.x Oct 10, 2024
8 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Oct 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Cart discount applied to the total price instead of the subtotal
4 participants