You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When you apply a side effect in onDeactivate for a promotion action, that e.g. saves a values on an orderLine, it gets overridden and cancelled out bc the removeCouponCode, by saving the affectedOrderLines that were loaded before the side effects are executed in applyPriceAdjustments, effectively uses outdated instances of the orderlines to resave those order lines.
To Reproduce
Steps to reproduce the behavior:
Create a customField on an orderLine
Write a value to it in onActivate
Remove the value in onDeactivate
Query the database to see it's still there
Expected behavior
Side effects of promotions should not be removed by accident
Environment (please complete the following information):
@vendure/core version: 3.0.x, 3.1.1
Additional context
Another issue in this context is that a PromotionItemAction runs on an OrderLine but the side effects runs on the entire order. It should also offer additional side effects that just operate on the Item OrderLine
The text was updated successfully, but these errors were encountered:
I have written a fix and I will submit it as soon as I've finished writing tests.
mschipperheyn
changed the title
Promotion remove side effects gets overridden by removeCouponCode
Promotion onDeactivate side effects gets overridden by removeCouponCode
Dec 26, 2024
mschipperheyn
changed the title
Promotion onDeactivate side effects gets overridden by removeCouponCode
Promotion onDeactivate side effects get overridden by removeCouponCode
Dec 26, 2024
Describe the bug
When you apply a side effect in
onDeactivate
for a promotionaction
, that e.g. saves a values on anorderLine
, it gets overridden and cancelled out bc theremoveCouponCode
, by saving theaffectedOrderLines
that were loaded before the side effects are executed inapplyPriceAdjustments
, effectively uses outdated instances of the orderlines toresave
those order lines.To Reproduce
Steps to reproduce the behavior:
onActivate
onDeactivate
Expected behavior
Side effects of promotions should not be removed by accident
Environment (please complete the following information):
Additional context
Another issue in this context is that a PromotionItemAction runs on an
OrderLine
but the side effects runs on the entire order. It should also offer additional side effects that just operate on the Item OrderLineThe text was updated successfully, but these errors were encountered: