Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Use satchless handler in cart
Michal Ociepkaa3d31743a873
diff --git a/cart/__init__.py b/cart/__init__.pyindex dfa1cd2eda..f81e2d7caa 100755--- a/cart/__init__.py+++ b/cart/__init__.py@@ -4,6 +4,7 @@ from prices import Pricefrom product.models import StockedProductfrom satchless import cartfrom satchless.item import Item, ItemLine, ItemSet, Partitioner+from shipping import get_shipping_methodsfrom userprofile.forms import AddressFormimport datetime@@ -22,18 +23,6 @@ class DeliveryLine(ItemLine):return self.price-class Shipping(Item):-- def get_price_per_item(self, **kwargs):- return Price(5, currency=settings.SATCHLESS_DEFAULT_CURRENCY)-- def __unicode__(self):- return u'Shipping'-- def get_Form(self):- return AddressForm--class BaseDeliveryGroup(ItemSet):def get_total(self, **kwargs):@@ -45,13 +34,13 @@ class BaseDeliveryGroup(ItemSet):return min(method.get_price_per_item(**kwargs) for method in methods)def get_delivery_methods(self, **kwargs):- yield Shipping(**kwargs)+ return [shipping for shipping in get_shipping_methods(self, **kwargs)]class CartPartitioner(Partitioner):def __iter__(self):- yield BaseDeliveryGroup(list(self.item_set))+ yield BaseDeliveryGroup(list(self.subject))def get_delivery_subtotal(self, partion, **kwargs):return partion.get_delivery_total(**kwargs)