Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Revert changes unrelated to this PR

Marcin Gębalad78b03b35b59
diff --git a/saleor/checkout/templatetags/__init__.py b/saleor/checkout/templatetags/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/saleor/checkout/templatetags/checkout.py b/saleor/checkout/templatetags/checkout.py
deleted file mode 100644
index 7d63da2992..0000000000
--- a/saleor/checkout/templatetags/checkout.py
+++ /dev/null
@@ -1,17 +0,0 @@
-from django.template import Library
-
-from ..utils import get_deliveries, get_total
-
-
-register = Library()
-
-
-def get_checkout_deliveries(checkout):
- return get_deliveries(checkout.cart, checkout.shipping_method)
-
-
-def get_checkout_total(checkout):
- return get_total(
- checkout.cart, checkout.shipping_method, checkout.discount)
diff --git a/saleor/checkout/utils.py b/saleor/checkout/utils.py
deleted file mode 100644
index cb5abb8941..0000000000
--- a/saleor/checkout/utils.py
+++ /dev/null
@@ -1,49 +0,0 @@
-from django.conf import settings
-from prices import Price
-
-
-def get_deliveries(cart, shipping_method=None):
- """Return the cart split into shipment groups.
-
- Generates tuples consisting of a partition, its shipping cost and its
- total cost.
-
- Each partition is a list of tuples containing the cart line, its unit
- price and the line total.
- """
- for partition in cart.partition():
- if shipping_method and partition.is_shipping_required():
- shipping_cost = shipping_method.get_total()
- else:
- shipping_cost = Price(0, currency=settings.DEFAULT_CURRENCY)
- total_with_shipping = partition.get_total(
- discounts=cart.discounts) + shipping_cost
-
- partition = [
- (
- line,
- line.get_price_per_item(discounts=cart.discounts),
- line.get_total(discounts=cart.discounts))
- for line in partition]
- yield partition, shipping_cost, total_with_shipping
-
-
-def get_subtotal(cart, shipping_method):
- """Calculate order total without shipping."""
- deliveries = get_deliveries(cart, shipping_method)
- zero = Price(0, currency=settings.DEFAULT_CURRENCY)
- cost_iterator = (
- total - shipping_cost
- for shipment, shipping_cost, total in deliveries)
- total = sum(cost_iterator, zero)
- return total
-
-
-def get_total(cart, shipping_method, discount=None):
- """Calculate order total with shipping."""
- deliveries = get_deliveries(cart, shipping_method)
- zero = Price(0, currency=settings.DEFAULT_CURRENCY)
- cost_iterator = (
- total for shipment, shipping_cost, total in deliveries)
- total = sum(cost_iterator, zero)
- return total if discount is None else discount.apply(total)