parent item mutations
Build and Publish / BuildAndDeployAmd64 (push) Failing after 5s
Build and Publish / BuildAndDeployArm64 (push) Failing after 7s

This commit is contained in:
2026-07-08 11:39:42 +02:00
parent e20793a6b3
commit 9f1eca07e9
14 changed files with 784 additions and 103 deletions
+6 -2
View File
@@ -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