Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Add specific product voucher amonut calculation with sale
fowczareke5c79f04b307
diff --git a/saleor/checkout/utils.py b/saleor/checkout/utils.pyindex f8758ef34e..d1df751841 100644--- a/saleor/checkout/utils.py+++ b/saleor/checkout/utils.py@@ -101,7 +101,7 @@ def remove_unavailable_variants(checkout):add_variant_to_checkout(checkout, line.variant, quantity, replace=True)-def get_prices_of_discounted_specific_product(lines, voucher):+def get_prices_of_discounted_specific_product(lines, voucher, discounts=None):"""Get prices of variants belonging to the discounted specific products.Specific products are products, collections and categories.@@ -131,7 +131,7 @@ def get_prices_of_discounted_specific_product(lines, voucher):discounted_lines.extend(list(lines))for line in discounted_lines:- 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)@@ -776,7 +776,7 @@ def _get_products_voucher_discount(checkout, voucher, discounts=None):"""prices = Noneif voucher.type == VoucherType.SPECIFIC_PRODUCT:- prices = get_prices_of_discounted_specific_product(checkout, voucher)+ prices = get_prices_of_discounted_specific_product(checkout, voucher, discounts)elif voucher.type == VoucherType.PRODUCT:prices = get_prices_of_discounted_products(checkout, voucher.products.all())elif voucher.type == VoucherType.COLLECTION: