Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Add missing undiscounted total price in order line (#14060)
Krzysztof Waliczekc0e3bf9f0b48
diff --git a/saleor/graphql/order/tests/queries/test_order_line.py b/saleor/graphql/order/tests/queries/test_order_line.pyindex 9f6fcc5b4e..82141c826e 100644--- a/saleor/graphql/order/tests/queries/test_order_line.py+++ b/saleor/graphql/order/tests/queries/test_order_line.py@@ -46,6 +46,12 @@ def test_order_line_query(amount}}+ undiscountedTotalPrice {+ currency+ gross {+ amount+ }+ }metadata {keyvalue@@ -104,6 +110,7 @@ def test_order_line_query(currency="USD",)assert first_order_data_line["totalPrice"]["currency"] == line.unit_price.currency+ assert first_order_data_line["undiscountedTotalPrice"]["currency"] == line.currencyassert expected_unit_price == line.unit_price.grossexpected_total_price = Money(@@ -112,6 +119,12 @@ def test_order_line_query()assert expected_total_price == line.unit_price.gross * line.quantity+ expected_undiscounted_total_price = Money(+ amount=str(first_order_data_line["undiscountedTotalPrice"]["gross"]["amount"]),+ currency="USD",+ )+ assert expected_undiscounted_total_price == line.undiscounted_total_price.gross+allocation = line.allocations.first()allocation_id = graphene.Node.to_global_id("Allocation", allocation.pk)warehouse_id = graphene.Node.to_global_id(diff --git a/saleor/graphql/order/types.py b/saleor/graphql/order/types.pyindex a1ae4fa1aa..7d4f9bab32 100644--- a/saleor/graphql/order/types.py+++ b/saleor/graphql/order/types.py@@ -699,6 +699,11 @@ class OrderLine(ModelObjectType[models.OrderLine]):total_price = graphene.Field(TaxedMoney, description="Price of the order line.", required=True)+ undiscounted_total_price = graphene.Field(+ TaxedMoney,+ description="Price of the order line without discounts.",+ required=True,+ )variant = graphene.Field(ProductVariant,required=False,diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphqlindex c68c24b94b..25024ea651 100644--- a/saleor/graphql/schema.graphql+++ b/saleor/graphql/schema.graphql@@ -11526,6 +11526,9 @@ type OrderLine implements Node & ObjectWithMetadata @doc(category: "Orders") {"""Price of the order line."""totalPrice: TaxedMoney!+ """Price of the order line without discounts."""+ undiscountedTotalPrice: TaxedMoney!+"""A purchased product variant. Note: this field may be null if the variant has been removed from stock at all. Requires one of the following permissions to include the unpublished items: MANAGE_ORDERS, MANAGE_DISCOUNTS, MANAGE_PRODUCTS."""