feat: cart detail leads to order creation
This commit is contained in:
+3
-2
@@ -88,6 +88,7 @@ def create_order_from_cart(
|
||||
shipping_state=shipping_address.address_state,
|
||||
shipping_country=shipping_address.address_country,
|
||||
shipping_zip=shipping_address.address_zip,
|
||||
user=cart.user,
|
||||
)
|
||||
|
||||
for item in cart.items.all():
|
||||
@@ -95,7 +96,7 @@ def create_order_from_cart(
|
||||
price: ProductPrice = product.price
|
||||
base_total = price.price * item.quantity
|
||||
tax_value = price.tax.value
|
||||
taxes = base_total * (tax_value / 100)
|
||||
taxes = base_total * tax_value / Decimal(100)
|
||||
total = base_total + taxes
|
||||
|
||||
OrderLine.objects.create(
|
||||
@@ -119,7 +120,7 @@ def add_shipping_order_line(order, shipping_method):
|
||||
shipping_price: ProductPrice = shipping_method.shipping_product.price
|
||||
shipping_base_total = shipping_price.price
|
||||
shipping_tax_value = shipping_price.tax.value
|
||||
shipping_taxes = shipping_base_total * (shipping_tax_value / 100)
|
||||
shipping_taxes = shipping_base_total * (shipping_tax_value / Decimal(100))
|
||||
shipping_total = shipping_base_total + shipping_taxes
|
||||
|
||||
OrderLine.objects.create(
|
||||
|
||||
Reference in New Issue
Block a user