feat: order creation on cart detail view
This commit is contained in:
+14
-8
@@ -91,12 +91,18 @@ def cart(request, *args, **kwargs):
|
||||
|
||||
total = base_total + tax_total
|
||||
|
||||
billing_addresses = CustomerAddress.objects.filter(
|
||||
user=request.user, address_type=CustomerAddress.Types.BILLING
|
||||
)
|
||||
shipping_addresses = CustomerAddress.objects.filter(
|
||||
user=request.user, address_type=CustomerAddress.Types.SHIPPING
|
||||
)
|
||||
if request.user.is_authenticated:
|
||||
billing_address = CustomerAddress.objects.filter(
|
||||
user=request.user, address_type=CustomerAddress.Types.BILLING, default=True
|
||||
).first()
|
||||
shipping_address = CustomerAddress.objects.filter(
|
||||
user=request.user,
|
||||
address_type=CustomerAddress.Types.SHIPPING,
|
||||
).first()
|
||||
else:
|
||||
billing_address = None
|
||||
shipping_address = None
|
||||
|
||||
shipping_methods = ShippingMethod.objects.all()
|
||||
|
||||
response = render(
|
||||
@@ -108,8 +114,8 @@ def cart(request, *args, **kwargs):
|
||||
"total": total,
|
||||
"base_total": base_total,
|
||||
"tax_total": tax_total,
|
||||
"billing_addresses": billing_addresses,
|
||||
"shipping_addresses": shipping_addresses,
|
||||
"billing_address": billing_address,
|
||||
"shipping_address": shipping_address,
|
||||
"shipping_methods": shipping_methods,
|
||||
},
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user