Multiple BuyXGetY promotions with the same gift product are not applying correctly
When the second promotion retrieves the order item created by the first promotion using the findOrCreateOrderItem method, it comes with an outdated order.
It seems that the `buildAdjustmentAmount` method does not correctly calculate the unit price in the second promotion when the promotion is included.
Steps to reproduce it
Please review the failing test for further investigation.
| Comment | File | Size | Author |
|---|
Issue fork commerce-3474801
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
facine commentedComment #4
facine commentedComment #5
facine commentedIt seems that the unit price is reset the second time the promotion is applied due to the issue at this line: https://git.drupalcode.org/project/commerce/-/blob/3.0.x/modules/promoti....
For now, as a workaround, I recalculate the unit price in the `buildAdjustmentAmount` method before calculating the new adjustment.
Comment #6
jsacksick commentedI don't consider this a "critical" bug report TBH (per https://www.drupal.org/docs/develop/issues/fields-and-other-parts-of-an-...).