MahmudulHassan5809 / django-shopping-cart

MIT License
34 stars 19 forks source link

Django shopping cart total amount #2

Open GannTrader opened 3 years ago

GannTrader commented 3 years ago

hi i want to know how i can total amount of all products?

MahmudulHassan5809 commented 3 years ago

I will update it tomorrow.Thanks

johnnyunar commented 3 years ago

Hi!

This would be a great feature, yet it is still not there.

muhacodes commented 2 years ago

hello @MahmudulHassan5809 could you please kindly add that small feature where i can get the total amount of all products

maazshipra commented 1 year ago

Edit this this in veiws.py

@login_required(login_url="/users/login") def cart_detail(request): total_amt = 0 for id,item in request.session['cart'].items(): total_amt+= int(item['quantity'])*float(item['price']) return render(request, 'cart_detail.html', {'total': total_amt})

JensTimmerman commented 9 months ago

it is available, with the context preprocessor, you can just use Total price € {{ cart_total_amount|floatformat:2 }} in your template