Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Add specific collection amonut calculation with sale
fowczarekd84e2eb90c78
diff --git a/saleor/checkout/utils.py b/saleor/checkout/utils.pyindex 352d598c84..a1cb0070d0 100644--- a/saleor/checkout/utils.py+++ b/saleor/checkout/utils.py@@ -156,7 +156,9 @@ def get_prices_of_discounted_products(checkout, discounted_products, discounts=Nreturn line_prices-def get_prices_of_products_in_discounted_collections(checkout, discounted_collections):+def get_prices_of_products_in_discounted_collections(+ checkout, discounted_collections, discounts=None+):"""Get prices of variants belonging to the discounted collections."""# If there's no discounted collections,# it means that all of them are discounted@@ -167,7 +169,7 @@ def get_prices_of_products_in_discounted_collections(checkout, discounted_colleccontinueproduct_collections = line.variant.product.collections.all()if set(product_collections).intersection(discounted_collections):- line_total = calculate_checkout_line_total(line, []).gross+ line_total = calculate_checkout_line_total(line, discounts).grossline_unit_price = quantize_price((line_total / line.quantity), line_total.currency)@@ -783,7 +785,7 @@ def _get_products_voucher_discount(checkout, voucher, discounts=None):)elif voucher.type == VoucherType.COLLECTION:prices = get_prices_of_products_in_discounted_collections(- checkout, voucher.collections.all()+ checkout, voucher.collections.all(), discounts)elif voucher.type == VoucherType.CATEGORY:prices = get_prices_of_products_in_discounted_categories(