Update cart-grain.go
All checks were successful
Build and Publish / Metadata (push) Successful in 11s
Build and Publish / BuildAndDeployAmd64 (push) Successful in 59s
Build and Publish / BuildAndDeployArm64 (push) Successful in 5m0s

This commit is contained in:
matst80
2025-11-11 09:52:52 +01:00
parent 3fa0009b95
commit 81246fe497

View File

@@ -249,14 +249,14 @@ func (c *CartGrain) UpdateTotals() {
c.TotalDiscount = NewPrice()
for _, item := range c.Items {
rowTotal := MultiplyPrice(*item.OrgPrice, int64(item.Quantity))
rowTotal := MultiplyPrice(item.Price, int64(item.Quantity))
if item.OrgPrice != nil {
diff := NewPrice()
diff.Add(*item.OrgPrice)
diff.Subtract(item.Price)
diff.Multiply(int64(item.Quantity))
rowTotal.Subtract(*diff)
//rowTotal.Subtract(*diff)
item.Discount = diff
if diff.IncVat > 0 {
c.TotalDiscount.Add(*diff)