Skip to content

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

Sort items before grouping

Adam Bogdalf591a264595a
diff --git a/cart/__init__.py b/cart/__init__.py
index e5fbaef008..c1e17d9126 100755
--- a/cart/__init__.py
+++ b/cart/__init__.py
@@ -68,6 +68,7 @@ class CartPartitioner(Partitioner):
'''
Change this method to provide custom delivery groups.
'''
+ self.subject = sorted(self.subject, key=self.classify)
for classifier, items in groupby(self.subject, self.classify):
delivery_class = self.get_delivery_class(classifier)
delivery = delivery_class(items)