From e86c4a0cc8281ce975e14a9cafd1834fffb5f84d Mon Sep 17 00:00:00 2001 From: giles Date: Sat, 21 Feb 2026 21:11:54 +0000 Subject: [PATCH] Fix Decimal+float TypeError in cart total calculation Product prices are float from DB but calendar/ticket totals are Decimal, causing TypeError when summed in cart_context. Wrap prices in Decimal(). Co-Authored-By: Claude Opus 4.6 --- bp/cart/services/total.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bp/cart/services/total.py b/bp/cart/services/total.py index 3f9b484..8dcdaf9 100644 --- a/bp/cart/services/total.py +++ b/bp/cart/services/total.py @@ -1,6 +1,12 @@ +from decimal import Decimal + + def total(cart): return sum( - (item.product.special_price or item.product.regular_price) * item.quantity + ( + Decimal(str(item.product.special_price or item.product.regular_price)) + * item.quantity + ) for item in cart if (item.product.special_price or item.product.regular_price) is not None )