Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Change name of function to get correct price
Maciej Korycinskib3f584e49652
diff --git a/saleor/checkout/views/__init__.py b/saleor/checkout/views/__init__.pyindex 3ef82cc648..e8f77cf94e 100644--- a/saleor/checkout/views/__init__.py+++ b/saleor/checkout/views/__init__.py@@ -3,10 +3,9 @@ from django.http import JsonResponsefrom django.shortcuts import get_object_or_404, redirect, renderfrom django.template.response import TemplateResponse-from saleor.core.utils.taxes import price-from ...account.forms import LoginFormfrom ...core.utils import format_money, get_user_shipping_country, to_local_currency+from ...core.utils.taxes import get_display_pricefrom ...shipping.utils import get_shipping_price_estimatefrom ..forms import CheckoutShippingMethodForm, CountryForm, ReplaceCheckoutLineFormfrom ..models import Checkout@@ -220,7 +219,7 @@ def update_checkout_line(request, checkout, variant_id):form.save()checkout.refresh_from_db()checkout_line.refresh_from_db()- subtotal = price(checkout_line.get_total(discounts, taxes))+ subtotal = get_display_price(checkout_line.get_total(discounts, taxes))response = {"variantId": variant_id,"subtotal": format_money(subtotal),@@ -228,7 +227,7 @@ def update_checkout_line(request, checkout, variant_id):"checkout": {"numItems": checkout.quantity, "numLines": len(checkout)},}- checkout_total = price(checkout.get_subtotal(discounts, taxes))+ checkout_total = get_display_price(checkout.get_subtotal(discounts, taxes))response["total"] = format_money(checkout_total)local_checkout_total = to_local_currency(checkout_total, request.currency)if local_checkout_total is not None:diff --git a/saleor/core/templatetags/taxed_prices.py b/saleor/core/templatetags/taxed_prices.pyindex 442eb796e1..d816cead25 100644--- a/saleor/core/templatetags/taxed_prices.py+++ b/saleor/core/templatetags/taxed_prices.py@@ -1,7 +1,7 @@from django import templatefrom prices import MoneyRange, TaxedMoney, TaxedMoneyRange-from ...core.utils.taxes import DEFAULT_TAX_RATE_NAME, price as get_price+from ...core.utils.taxes import DEFAULT_TAX_RATE_NAME, get_display_priceregister = template.Library()@@ -28,7 +28,7 @@ def price(context, base, display_gross=None, html=True):if display_gross is None:display_gross = context["site"].settings.display_gross_prices- base = get_price(base, display_gross)+ base = get_display_price(base, display_gross)is_range = isinstance(base, MoneyRange)return {"price": base, "is_range": is_range, "html": html}diff --git a/saleor/core/utils/taxes.py b/saleor/core/utils/taxes.pyindex dbf72012ce..3267cbc07c 100644--- a/saleor/core/utils/taxes.py+++ b/saleor/core/utils/taxes.py@@ -108,7 +108,9 @@ def get_taxed_shipping_price(shipping_price, taxes):return apply_tax_to_price(taxes, DEFAULT_TAX_RATE_NAME, shipping_price)-def price(base: Union[TaxedMoney, TaxedMoneyRange], display_gross=None) -> Money:+def get_display_price(+ base: Union[TaxedMoney, TaxedMoneyRange], display_gross=None+) -> Money:"""Return price amount that should be displayed based on settings"""if not display_gross:display_gross = display_gross_prices()