Skip to content

Conversation

@alexmarqs
Copy link
Member

The Issue:
When we have more than 2 onetime items where the second has a discount, the before_discount_amount_total for the recurrence is incorrectly calculated because it didn't account for the first item's amount (which had no discount).

The Fix:
Changed the logic to initialise existingRecurrenceBeforeDiscountAmountTotal with the recurrence current amount_total (minus the item being added) when it's undefined, ensuring all previously added items are included in the before-discount calculation, even if they didn't have discounts themselves.

@alexmarqs alexmarqs changed the title fix: Add support for unordered price items with discounts and enhance… fix: correct calculations for unordered price items with discounts Nov 26, 2025
Copy link
Contributor

@JoFont JoFont left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Yeah, tricky one this one. I don't know how this was not caught earlier...

@alexmarqs alexmarqs merged commit 71cb28d into main Nov 26, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants