parent item mutations
This commit is contained in:
@@ -86,13 +86,17 @@ func newPromotionEvaluateWithCartHandler(store *promotions.Store, svc *promotion
|
||||
// main.go uses. Going through the shared
|
||||
// PromotionService.EvaluateAndApply means the bypass
|
||||
// loop, the re-eval trigger, and ApplyResults stay
|
||||
// in lockstep with post-add behavior.
|
||||
// in lockstep with post-add behavior. EvaluateAndApply
|
||||
// populates g.EvaluatedItems via cart.MapEvaluatedItems
|
||||
// on its final step, so the preview response reuses the
|
||||
// same per-line projection the live cart renders — math
|
||||
// and rounding stay in lockstep across both paths.
|
||||
svc.EvaluateAndApply(store.Snapshot(), g, previewContextOptions(req)...)
|
||||
resp = promotions.EvaluateResponse{
|
||||
TotalPrice: g.TotalPrice,
|
||||
TotalDiscount: g.TotalDiscount,
|
||||
AppliedPromotions: g.AppliedPromotions,
|
||||
Items: promotions.MapEvaluatedItems(g),
|
||||
Items: g.EvaluatedItems,
|
||||
}
|
||||
} else {
|
||||
// No live cart (missing/invalid cookie, fetch failed, or
|
||||
|
||||
Reference in New Issue
Block a user