Skip to content

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

Add discount_value_type to Voucher graphene's object

Maciej Korycinskid85dfc959f72
diff --git a/saleor/graphql/discount/types.py b/saleor/graphql/discount/types.py
index 1143f3aff9..87bad60989 100644
--- a/saleor/graphql/discount/types.py
+++ b/saleor/graphql/discount/types.py
@@ -10,6 +10,7 @@ from ..product.types import Category, Collection, Product
from ..translations.enums import LanguageCodeEnum
from ..translations.resolvers import resolve_translation
from ..translations.types import SaleTranslation, VoucherTranslation
+from .enums import DiscountValueTypeEnum
class Sale(CountableDjangoObjectType):
@@ -96,6 +97,9 @@ class Voucher(CountableDjangoObjectType):
description="Returns translated Voucher fields for the given language code.",
resolver=resolve_translation,
)
+ discount_value_type = DiscountValueTypeEnum(
+ description="Determines a type of voucher - value or percentage", required=True
+ )
class Meta:
description = """
diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphql
index d7ce9975e9..7d74cd3124 100644
--- a/saleor/graphql/schema.graphql
+++ b/saleor/graphql/schema.graphql
@@ -3110,7 +3110,7 @@ type Voucher implements Node {
startDate: DateTime!
endDate: DateTime
applyOncePerOrder: Boolean!
- discountValueType: VoucherDiscountValueType!
+ discountValueType: DiscountValueTypeEnum!
discountValue: Float!
minAmountSpent: Money
categories(before: String, after: String, first: Int, last: Int): CategoryCountableConnection
@@ -3157,11 +3157,6 @@ enum VoucherDiscountType {
SHIPPING
}
-enum VoucherDiscountValueType {
- FIXED
- PERCENTAGE
-}
-
input VoucherFilterInput {
status: [DiscountStatusEnum]
timesUsed: IntRangeInput