Merge branch 'main' of git-ssh.tornberg.me:mats/go-cart-actor
All checks were successful
Build and Publish / Metadata (push) Successful in 9s
Build and Publish / BuildAndDeployAmd64 (push) Successful in 1m22s
Build and Publish / BuildAndDeployArm64 (push) Successful in 4m1s

This commit is contained in:
matst80
2025-10-14 23:24:29 +02:00

View File

@@ -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()