From 104f9fbb4cfbfd7d6467f30de1c134c7ab5b7285 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mats=20T=C3=B6rnberg?= Date: Tue, 14 Oct 2025 23:12:01 +0200 Subject: [PATCH] missing updates (#5) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: matst80 Reviewed-on: https://git.tornberg.me/mats/go-cart-actor/pulls/5 Co-authored-by: Mats Törnberg Co-committed-by: Mats Törnberg --- cmd/cart/mutation_add_item.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cmd/cart/mutation_add_item.go b/cmd/cart/mutation_add_item.go index 5f5c07b..459b9cc 100644 --- a/cmd/cart/mutation_add_item.go +++ b/cmd/cart/mutation_add_item.go @@ -30,8 +30,12 @@ func AddItem(g *CartGrain, m *messages.AddItem) error { // Fast path: merge with existing item having same SKU if existing, found := g.FindItemWithSku(m.Sku); found { - existing.Quantity += int(m.Quantity) - return nil + if existing.StoreId == m.StoreId { + existing.Quantity += int(m.Quantity) + existing.Stock = StockStatus(m.Stock) + existing.StoreId = m.StoreId + return nil + } } g.mu.Lock()