Add LineItem for each variation
This commit is contained in:
parent
b009b1bc85
commit
13d016c888
@ -16,7 +16,8 @@ from core import (
|
|||||||
OrderStatus,
|
OrderStatus,
|
||||||
ShippingMethodType,
|
ShippingMethodType,
|
||||||
ShippingService,
|
ShippingService,
|
||||||
ShippingContainer
|
ShippingContainer,
|
||||||
|
CoffeeGrind
|
||||||
)
|
)
|
||||||
|
|
||||||
from .payments import CreateOrder
|
from .payments import CreateOrder
|
||||||
@ -172,14 +173,18 @@ class Cart:
|
|||||||
return response
|
return response
|
||||||
|
|
||||||
def build_bulk_list(self, order):
|
def build_bulk_list(self, order):
|
||||||
bulk_list = [OrderLine(
|
bulk_list = []
|
||||||
order=order,
|
|
||||||
product=item['product'],
|
for item in self:
|
||||||
customer_note=f"{item['variations']}",
|
for key, value in item['variations'].items():
|
||||||
unit_price=item['price'],
|
bulk_list.append(OrderLine(
|
||||||
quantity=item['quantity'],
|
order=order,
|
||||||
tax_rate=2,
|
product=item['product'],
|
||||||
) for item in self]
|
customer_note=next((v[1] for i, v in enumerate(CoffeeGrind.GRIND_CHOICES) if v[0] == key), None),
|
||||||
|
unit_price=item['price'],
|
||||||
|
quantity=value['quantity'],
|
||||||
|
tax_rate=2,
|
||||||
|
))
|
||||||
|
|
||||||
return bulk_list
|
return bulk_list
|
||||||
|
|
||||||
|
|||||||
@ -234,6 +234,8 @@ class OrderCreateView(CreateView):
|
|||||||
|
|
||||||
return JsonResponse(data)
|
return JsonResponse(data)
|
||||||
|
|
||||||
|
@csrf_exempt
|
||||||
|
@require_POST
|
||||||
def paypal_order_transaction_capture(request, transaction_id):
|
def paypal_order_transaction_capture(request, transaction_id):
|
||||||
if request.method =="POST":
|
if request.method =="POST":
|
||||||
data = CaptureOrder().capture_order(transaction_id)
|
data = CaptureOrder().capture_order(transaction_id)
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta content="width=device-width, initial-scale=1.0" name="viewport">
|
<meta content="width=device-width, initial-scale=1.0" name="viewport">
|
||||||
<meta content="chrome=1" http-equiv="X-UA-Compatible">
|
<meta content="chrome=1" http-equiv="X-UA-Compatible">
|
||||||
<title>{% block head_title %}{% endblock %} Port Townsend Coffee</title>
|
<title>{% block head_title %}{% endblock %} Port Townsend Roasting Co.</title>
|
||||||
<meta name="author" content="Nathan Chapman">
|
<meta name="author" content="Nathan Chapman">
|
||||||
|
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user