Skip to content

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

Update unit discount fields description (#17048)

Piotr Zabieglik2d647ca99d57
diff --git a/saleor/graphql/order/types.py b/saleor/graphql/order/types.py
index f182319c5e..ccfd9dbfa1 100644
--- a/saleor/graphql/order/types.py
+++ b/saleor/graphql/order/types.py
@@ -788,9 +788,6 @@ class OrderLine(ModelObjectType[models.OrderLine]):
quantity_fulfilled = graphene.Int(
required=True, description="Number of variant items fulfilled."
)
- unit_discount_reason = graphene.String(
- description="Reason for any discounts applied on a product in the order."
- )
tax_rate = graphene.Float(
required=True, description="Rate of tax applied on product variant."
)
@@ -798,27 +795,55 @@ class OrderLine(ModelObjectType[models.OrderLine]):
thumbnail = ThumbnailField()
unit_price = graphene.Field(
TaxedMoney,
- description="Price of the single item in the order line.",
+ description=(
+ "Price of the single item in the order line with all the line-level "
+ "discounts and order-level discount portions applied."
+ ),
required=True,
)
undiscounted_unit_price = graphene.Field(
TaxedMoney,
description=(
- "Price of the single item in the order line without applied an order line "
- "discount."
+ "Price of the single item in the order line without any discount applied."
),
required=True,
)
unit_discount = graphene.Field(
Money,
- description="The discount applied to the single order line.",
+ description=(
+ "Sum of the line-level discounts applied to the order line. "
+ "Order-level discounts which affect the line are not visible in this field."
+ " For order-level discount portion (if any), please query `order.discounts`"
+ " field."
+ ),
required=True,
)
+ unit_discount_reason = graphene.String(
+ description=(
+ "Reason for line-level discounts applied on the order line. Order-level "
+ "discounts which affect the line are not visible in this field. For "
+ "order-level discount reason (if any), please query `order.discounts` "
+ "field."
+ )
+ )
unit_discount_value = graphene.Field(
PositiveDecimal,
- description="Value of the discount. Can store fixed value or percent value",
+ description=(
+ "Value of the discount. Can store fixed value or percent value. "
+ "This field shouldn't be used when multiple discounts affect the line. "
+ "There is a limitation, that after running `checkoutComplete` mutation "
+ "the field always stores fixed value."
+ ),
required=True,
)
+ unit_discount_type = graphene.Field(
+ DiscountValueTypeEnum,
+ description=(
+ "Type of the discount: `fixed` or `percent`. This field shouldn't be used "
+ "when multiple discounts affect the line. There is a limitation, that after"
+ " running `checkoutComplete` mutation the field is always set to `fixed`."
+ ),
+ )
total_price = graphene.Field(
TaxedMoney, description="Price of the order line.", required=True
)
@@ -864,10 +889,6 @@ class OrderLine(ModelObjectType[models.OrderLine]):
quantity_to_fulfill = graphene.Int(
required=True, description="A quantity of items remaining to be fulfilled."
)
- unit_discount_type = graphene.Field(
- DiscountValueTypeEnum,
- description="Type of the discount: fixed or percent",
- )
tax_class = PermissionsField(
TaxClass,
description=("Denormalized tax class of the product in this order line."),
diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphql
index 280c7660ee..8f13a4e9a4 100644
--- a/saleor/graphql/schema.graphql
+++ b/saleor/graphql/schema.graphql
@@ -11032,9 +11032,6 @@ type OrderLine implements Node & ObjectWithMetadata @doc(category: "Orders") {
"""Number of variant items fulfilled."""
quantityFulfilled: Int!
- """Reason for any discounts applied on a product in the order."""
- unitDiscountReason: String
-
"""Rate of tax applied on product variant."""
taxRate: Float!
digitalContentUrl: DigitalContentUrl
@@ -11050,20 +11047,36 @@ type OrderLine implements Node & ObjectWithMetadata @doc(category: "Orders") {
format: ThumbnailFormatEnum = ORIGINAL
): Image
- """Price of the single item in the order line."""
+ """
+ Price of the single item in the order line with all the line-level discounts and order-level discount portions applied.
+ """
unitPrice: TaxedMoney!
"""
- Price of the single item in the order line without applied an order line discount.
+ Price of the single item in the order line without any discount applied.
"""
undiscountedUnitPrice: TaxedMoney!
- """The discount applied to the single order line."""
+ """
+ Sum of the line-level discounts applied to the order line. Order-level discounts which affect the line are not visible in this field. For order-level discount portion (if any), please query `order.discounts` field.
+ """
unitDiscount: Money!
- """Value of the discount. Can store fixed value or percent value"""
+ """
+ Reason for line-level discounts applied on the order line. Order-level discounts which affect the line are not visible in this field. For order-level discount reason (if any), please query `order.discounts` field.
+ """
+ unitDiscountReason: String
+
+ """
+ Value of the discount. Can store fixed value or percent value. This field shouldn't be used when multiple discounts affect the line. There is a limitation, that after running `checkoutComplete` mutation the field always stores fixed value.
+ """
unitDiscountValue: PositiveDecimal!
+ """
+ Type of the discount: `fixed` or `percent`. This field shouldn't be used when multiple discounts affect the line. There is a limitation, that after running `checkoutComplete` mutation the field is always set to `fixed`.
+ """
+ unitDiscountType: DiscountValueTypeEnum
+
"""Price of the order line."""
totalPrice: TaxedMoney!
@@ -11099,9 +11112,6 @@ type OrderLine implements Node & ObjectWithMetadata @doc(category: "Orders") {
"""A quantity of items remaining to be fulfilled."""
quantityToFulfill: Int!
- """Type of the discount: fixed or percent"""
- unitDiscountType: DiscountValueTypeEnum
-
"""
Denormalized tax class of the product in this order line.